Antonio Maiorano d388bc9b36 Restore "MSL writer: make signed int overflow defined behaviour"
This reverts commit e33b0baa088146fc06881387157a92e19fcf5b7b.

Added tests/expressions/literals/intmin.wgsl test.

Bug: tint:124
Change-Id: I3d46f939ff20fa377ddb5fcb52f9afe728b8e430
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60441
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-30 18:59:06 +00:00

72 lines
1.7 KiB
Plaintext

#include <metal_stdlib>
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 = as_type<int>((as_type<uint>(x_11) + as_type<uint>(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 = as_type<int>((as_type<uint>(x_16) + as_type<uint>(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;
}