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 <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Alastair Donaldson
2021-07-23 13:10:12 +00:00
committed by Tint LUCI CQ
parent bd3edb564f
commit f7e73d4ee3
5160 changed files with 621458 additions and 0 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -0,0 +1,104 @@
#include <metal_stdlib>
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;
}

View File

@@ -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

View File

@@ -0,0 +1,94 @@
var<private> x_GLF_color : vec4<f32>;
fn func_i1_(x : ptr<function, i32>) {
var a : i32;
var data : array<i32, 9>;
var temp : array<i32, 2>;
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<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(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<f32>;
};
[[stage(fragment)]]
fn main() -> main_out {
main_1();
return main_out(x_GLF_color);
}

View File

@@ -0,0 +1,94 @@
var<private> x_GLF_color : vec4<f32>;
fn func_i1_(x : ptr<function, i32>) {
var a : i32;
var data : array<i32, 9>;
var temp : array<i32, 2>;
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<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(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<f32>;
};
[[stage(fragment)]]
fn main() -> main_out {
main_1();
return main_out(x_GLF_color);
}

View File

@@ -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;
}

View File

@@ -0,0 +1,104 @@
#include <metal_stdlib>
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;
}

View File

@@ -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

View File

@@ -0,0 +1,94 @@
var<private> x_GLF_color : vec4<f32>;
fn func_i1_(x : ptr<function, i32>) {
var a : i32;
var data : array<i32, 9>;
var temp : array<i32, 2>;
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<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(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<f32>;
};
[[stage(fragment)]]
fn main() -> main_out {
main_1();
return main_out(x_GLF_color);
}