wgpu/naga/tests/out/msl/control-flow.msl

226 lines
4.3 KiB
Plaintext
Raw Normal View History

// language: metal1.0
2021-05-03 04:18:35 +00:00
#include <metal_stdlib>
#include <simd/simd.h>
using metal::uint;
2021-05-03 04:18:35 +00:00
void switch_default_break(
int i
) {
switch(i) {
default: {
break;
}
}
}
void switch_case_break(
) {
switch(0) {
case 0: {
break;
}
default: {
break;
}
}
return;
}
void loop_switch_continue(
int x
) {
#define LOOP_IS_REACHABLE if (volatile bool unpredictable_jump_over_loop = true; unpredictable_jump_over_loop)
LOOP_IS_REACHABLE while(true) {
switch(x) {
case 1: {
continue;
}
default: {
break;
}
}
}
return;
}
void loop_switch_continue_nesting(
int x_1,
int y,
int z
) {
LOOP_IS_REACHABLE while(true) {
switch(x_1) {
case 1: {
continue;
}
case 2: {
switch(y) {
case 1: {
continue;
}
default: {
LOOP_IS_REACHABLE while(true) {
switch(z) {
case 1: {
continue;
}
default: {
break;
}
}
}
break;
}
}
break;
}
default: {
break;
}
}
switch(y) {
default: {
continue;
}
}
}
LOOP_IS_REACHABLE while(true) {
switch(y) {
case 1:
default: {
switch(z) {
default: {
continue;
}
}
break;
}
}
}
return;
}
void loop_switch_omit_continue_variable_checks(
int x_2,
int y_1,
int z_1,
int w
) {
int pos_1 = 0;
LOOP_IS_REACHABLE while(true) {
switch(x_2) {
case 1: {
pos_1 = 1;
break;
}
default: {
break;
}
}
}
LOOP_IS_REACHABLE while(true) {
switch(x_2) {
case 1: {
break;
}
case 2: {
switch(y_1) {
case 1: {
continue;
}
default: {
switch(z_1) {
case 1: {
pos_1 = 2;
break;
}
default: {
break;
}
}
break;
}
}
break;
}
default: {
break;
}
}
}
return;
}
struct main_Input {
2021-05-03 04:18:35 +00:00
};
kernel void main_(
2021-05-03 04:18:35 +00:00
metal::uint3 global_id [[thread_position_in_grid]]
) {
int pos = {};
2021-05-03 04:18:35 +00:00
metal::threadgroup_barrier(metal::mem_flags::mem_device);
metal::threadgroup_barrier(metal::mem_flags::mem_threadgroup);
switch(1) {
default: {
pos = 1;
break;
}
}
int _e4 = pos;
switch(_e4) {
case 1: {
pos = 0;
break;
}
case 2: {
pos = 1;
break;
}
case 3:
case 4: {
pos = 2;
break;
}
case 5: {
pos = 3;
break;
}
default:
case 6: {
pos = 4;
break;
}
}
2021-09-19 21:31:38 +00:00
switch(0u) {
case 0u: {
break;
}
default: {
break;
}
2021-09-19 21:31:38 +00:00
}
int _e11 = pos;
switch(_e11) {
case 1: {
pos = 0;
break;
}
case 2: {
pos = 1;
return;
}
case 3: {
pos = 2;
return;
}
case 4: {
return;
}
default: {
pos = 3;
return;
}
}
2021-05-03 04:18:35 +00:00
}