Add support for increment/decrement statements

Refactor the ExpandCompoundAssignment transform to handle these
statements, which delivers support for all of the non-WGSL backends.

Fixed: tint:1488
Change-Id: I96cdc31851c61f6d92d296447d0b0637907d5fe5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86004
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price 2022-04-07 13:42:45 +00:00
parent b02fe31e46
commit d68d3a9809
76 changed files with 2052 additions and 838 deletions

View File

@ -6,6 +6,7 @@
* Parentheses are no longer required around expressions for if and switch statements [tint:1424](crbug.com/tint/1424) * Parentheses are no longer required around expressions for if and switch statements [tint:1424](crbug.com/tint/1424)
* Compound assignment statements are now supported. [tint:1325](https://crbug.com/tint/1325) * Compound assignment statements are now supported. [tint:1325](https://crbug.com/tint/1325)
* Postfix increment and decrement statements are now supported. [tint:1488](crbug.com/tint/1488)
* The colon in case statements is now optional. [tint:1485](crbug.com/tint/1485) * The colon in case statements is now optional. [tint:1485](crbug.com/tint/1485)
### Breaking changes ### Breaking changes

View File

@ -17,6 +17,7 @@
#include <utility> #include <utility>
#include "src/tint/ast/compound_assignment_statement.h" #include "src/tint/ast/compound_assignment_statement.h"
#include "src/tint/ast/increment_decrement_statement.h"
#include "src/tint/program_builder.h" #include "src/tint/program_builder.h"
#include "src/tint/sem/block_statement.h" #include "src/tint/sem/block_statement.h"
#include "src/tint/sem/expression.h" #include "src/tint/sem/expression.h"
@ -36,113 +37,159 @@ ExpandCompoundAssignment::~ExpandCompoundAssignment() = default;
bool ExpandCompoundAssignment::ShouldRun(const Program* program, bool ExpandCompoundAssignment::ShouldRun(const Program* program,
const DataMap&) const { const DataMap&) const {
for (auto* node : program->ASTNodes().Objects()) { for (auto* node : program->ASTNodes().Objects()) {
if (node->Is<ast::CompoundAssignmentStatement>()) { if (node->IsAnyOf<ast::CompoundAssignmentStatement,
ast::IncrementDecrementStatement>()) {
return true; return true;
} }
} }
return false; return false;
} }
/// Internal class used to collect statement expansions during the transform.
class State {
private:
/// The clone context.
CloneContext& ctx;
/// The program builder.
ProgramBuilder& b;
/// The HoistToDeclBefore helper instance.
HoistToDeclBefore hoist_to_decl_before;
public:
/// Constructor
/// @param context the clone context
explicit State(CloneContext& context)
: ctx(context), b(*ctx.dst), hoist_to_decl_before(ctx) {}
/// Replace `stmt` with a regular assignment statement of the form:
/// lhs = lhs op rhs
/// The LHS expression will only be evaluated once, and any side effects will
/// be hoisted to `let` declarations above the assignment statement.
/// @param stmt the statement to replace
/// @param lhs the lhs expression from the source statement
/// @param rhs the rhs expression in the destination module
/// @param op the binary operator
void Expand(const ast::Statement* stmt,
const ast::Expression* lhs,
const ast::Expression* rhs,
ast::BinaryOp op) {
// Helper function to create the new LHS expression. This will be called
// twice when building the non-compound assignment statement, so must
// not produce expressions that cause side effects.
std::function<const ast::Expression*()> new_lhs;
// Helper function to create a variable that is a pointer to `expr`.
auto hoist_pointer_to = [&](const ast::Expression* expr) {
auto name = b.Sym();
auto* ptr = b.AddressOf(ctx.Clone(expr));
auto* decl = b.Decl(b.Const(name, nullptr, ptr));
hoist_to_decl_before.InsertBefore(ctx.src->Sem().Get(stmt), decl);
return name;
};
// Helper function to hoist `expr` to a let declaration.
auto hoist_expr_to_let = [&](const ast::Expression* expr) {
auto name = b.Sym();
auto* decl = b.Decl(b.Const(name, nullptr, ctx.Clone(expr)));
hoist_to_decl_before.InsertBefore(ctx.src->Sem().Get(stmt), decl);
return name;
};
// Helper function that returns `true` if the type of `expr` is a vector.
auto is_vec = [&](const ast::Expression* expr) {
return ctx.src->Sem().Get(expr)->Type()->UnwrapRef()->Is<sem::Vector>();
};
// Hoist the LHS expression subtree into local constants to produce a new
// LHS that we can evaluate twice.
// We need to special case compound assignments to vector components since
// we cannot take the address of a vector component.
auto* index_accessor = lhs->As<ast::IndexAccessorExpression>();
auto* member_accessor = lhs->As<ast::MemberAccessorExpression>();
if (lhs->Is<ast::IdentifierExpression>() ||
(member_accessor &&
member_accessor->structure->Is<ast::IdentifierExpression>())) {
// This is the simple case with no side effects, so we can just use the
// original LHS expression directly.
// Before:
// foo.bar += rhs;
// After:
// foo.bar = foo.bar + rhs;
new_lhs = [&]() { return ctx.Clone(lhs); };
} else if (index_accessor && is_vec(index_accessor->object)) {
// This is the case for vector component via an array accessor. We need
// to capture a pointer to the vector and also the index value.
// Before:
// v[idx()] += rhs;
// After:
// let vec_ptr = &v;
// let index = idx();
// (*vec_ptr)[index] = (*vec_ptr)[index] + rhs;
auto lhs_ptr = hoist_pointer_to(index_accessor->object);
auto index = hoist_expr_to_let(index_accessor->index);
new_lhs = [&, lhs_ptr, index]() {
return b.IndexAccessor(b.Deref(lhs_ptr), index);
};
} else if (member_accessor && is_vec(member_accessor->structure)) {
// This is the case for vector component via a member accessor. We just
// need to capture a pointer to the vector.
// Before:
// a[idx()].y += rhs;
// After:
// let vec_ptr = &a[idx()];
// (*vec_ptr).y = (*vec_ptr).y + rhs;
auto lhs_ptr = hoist_pointer_to(member_accessor->structure);
new_lhs = [&, lhs_ptr]() {
return b.MemberAccessor(b.Deref(lhs_ptr),
ctx.Clone(member_accessor->member));
};
} else {
// For all other statements that may have side-effecting expressions, we
// just need to capture a pointer to the whole LHS.
// Before:
// a[idx()] += rhs;
// After:
// let lhs_ptr = &a[idx()];
// (*lhs_ptr) = (*lhs_ptr) + rhs;
auto lhs_ptr = hoist_pointer_to(lhs);
new_lhs = [&, lhs_ptr]() { return b.Deref(lhs_ptr); };
}
// Replace the statement with a regular assignment statement.
auto* value = b.create<ast::BinaryExpression>(op, new_lhs(), rhs);
ctx.Replace(stmt, b.Assign(new_lhs(), value));
}
/// Finalize the transformation and clone the module.
void Finalize() {
hoist_to_decl_before.Apply();
ctx.Clone();
}
};
void ExpandCompoundAssignment::Run(CloneContext& ctx, void ExpandCompoundAssignment::Run(CloneContext& ctx,
const DataMap&, const DataMap&,
DataMap&) const { DataMap&) const {
HoistToDeclBefore hoist_to_decl_before(ctx); State state(ctx);
for (auto* node : ctx.src->ASTNodes().Objects()) { for (auto* node : ctx.src->ASTNodes().Objects()) {
if (auto* assign = node->As<ast::CompoundAssignmentStatement>()) { if (auto* assign = node->As<ast::CompoundAssignmentStatement>()) {
auto* sem_assign = ctx.src->Sem().Get(assign); state.Expand(assign, assign->lhs, ctx.Clone(assign->rhs), assign->op);
} else if (auto* inc_dec = node->As<ast::IncrementDecrementStatement>()) {
// Helper function to create the LHS expression. This will be called twice // For increment/decrement statements, `i++` becomes `i = i + 1`.
// when building the non-compound assignment statement, so must not // TODO(jrprice): Simplify this when we have untyped literals.
// produce expressions that cause side effects. auto* sem_lhs = ctx.src->Sem().Get(inc_dec->lhs);
std::function<const ast::Expression*()> lhs; const ast::IntLiteralExpression* one =
sem_lhs->Type()->UnwrapRef()->is_signed_integer_scalar()
// Helper function to create a variable that is a pointer to `expr`. ? ctx.dst->Expr(1)->As<ast::IntLiteralExpression>()
auto hoist_pointer_to = [&](const ast::Expression* expr) { : ctx.dst->Expr(1u)->As<ast::IntLiteralExpression>();
auto name = ctx.dst->Sym(); auto op =
auto* ptr = ctx.dst->AddressOf(ctx.Clone(expr)); inc_dec->increment ? ast::BinaryOp::kAdd : ast::BinaryOp::kSubtract;
auto* decl = ctx.dst->Decl(ctx.dst->Const(name, nullptr, ptr)); state.Expand(inc_dec, inc_dec->lhs, one, op);
hoist_to_decl_before.InsertBefore(sem_assign, decl);
return name;
};
// Helper function to hoist `expr` to a let declaration.
auto hoist_expr_to_let = [&](const ast::Expression* expr) {
auto name = ctx.dst->Sym();
auto* decl =
ctx.dst->Decl(ctx.dst->Const(name, nullptr, ctx.Clone(expr)));
hoist_to_decl_before.InsertBefore(sem_assign, decl);
return name;
};
// Helper function that returns `true` if the type of `expr` is a vector.
auto is_vec = [&](const ast::Expression* expr) {
return ctx.src->Sem().Get(expr)->Type()->UnwrapRef()->Is<sem::Vector>();
};
// Hoist the LHS expression subtree into local constants to produce a new
// LHS that we can evaluate twice.
// We need to special case compound assignments to vector components since
// we cannot take the address of a vector component.
auto* index_accessor = assign->lhs->As<ast::IndexAccessorExpression>();
auto* member_accessor = assign->lhs->As<ast::MemberAccessorExpression>();
if (assign->lhs->Is<ast::IdentifierExpression>() ||
(member_accessor &&
member_accessor->structure->Is<ast::IdentifierExpression>())) {
// This is the simple case with no side effects, so we can just use the
// original LHS expression directly.
// Before:
// foo.bar += rhs;
// After:
// foo.bar = foo.bar + rhs;
lhs = [&]() { return ctx.Clone(assign->lhs); };
} else if (index_accessor && is_vec(index_accessor->object)) {
// This is the case for vector component via an array accessor. We need
// to capture a pointer to the vector and also the index value.
// Before:
// v[idx()] += rhs;
// After:
// let vec_ptr = &v;
// let index = idx();
// (*vec_ptr)[index] = (*vec_ptr)[index] + rhs;
auto lhs_ptr = hoist_pointer_to(index_accessor->object);
auto index = hoist_expr_to_let(index_accessor->index);
lhs = [&, lhs_ptr, index]() {
return ctx.dst->IndexAccessor(ctx.dst->Deref(lhs_ptr), index);
};
} else if (member_accessor && is_vec(member_accessor->structure)) {
// This is the case for vector component via a member accessor. We just
// need to capture a pointer to the vector.
// Before:
// a[idx()].y += rhs;
// After:
// let vec_ptr = &a[idx()];
// (*vec_ptr).y = (*vec_ptr).y + rhs;
auto lhs_ptr = hoist_pointer_to(member_accessor->structure);
lhs = [&, lhs_ptr]() {
return ctx.dst->MemberAccessor(ctx.dst->Deref(lhs_ptr),
ctx.Clone(member_accessor->member));
};
} else {
// For all other statements that may have side-effecting expressions, we
// just need to capture a pointer to the whole LHS.
// Before:
// a[idx()] += rhs;
// After:
// let lhs_ptr = &a[idx()];
// (*lhs_ptr) = (*lhs_ptr) + rhs;
auto lhs_ptr = hoist_pointer_to(assign->lhs);
lhs = [&, lhs_ptr]() { return ctx.dst->Deref(lhs_ptr); };
}
// Replace the compound assignment with a regular assignment.
auto* rhs = ctx.dst->create<ast::BinaryExpression>(
assign->op, lhs(), ctx.Clone(assign->rhs));
ctx.Replace(assign, ctx.dst->Assign(lhs(), rhs));
} }
} }
hoist_to_decl_before.Apply(); state.Finalize();
ctx.Clone();
} }
} // namespace transform } // namespace transform

View File

@ -36,6 +36,9 @@ namespace transform {
/// let _idx = bar(); /// let _idx = bar();
/// (*_vec)[_idx] = (*_vec)[_idx] * 2.0; /// (*_vec)[_idx] = (*_vec)[_idx] * 2.0;
/// ``` /// ```
///
/// This transform also handles increment and decrement statements in the same
/// manner, by replacing `i++` with `i = i + 1`.
class ExpandCompoundAssignment class ExpandCompoundAssignment
: public Castable<ExpandCompoundAssignment, Transform> { : public Castable<ExpandCompoundAssignment, Transform> {
public: public:

View File

@ -41,6 +41,17 @@ fn foo() {
EXPECT_TRUE(ShouldRun<ExpandCompoundAssignment>(src)); EXPECT_TRUE(ShouldRun<ExpandCompoundAssignment>(src));
} }
TEST_F(ExpandCompoundAssignmentTest, ShouldRunHasIncrementDecrement) {
auto* src = R"(
fn foo() {
var v : i32;
v++;
}
)";
EXPECT_TRUE(ShouldRun<ExpandCompoundAssignment>(src));
}
TEST_F(ExpandCompoundAssignmentTest, Basic) { TEST_F(ExpandCompoundAssignmentTest, Basic) {
auto* src = R"( auto* src = R"(
fn main() { fn main() {
@ -452,6 +463,284 @@ fn main() {
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(ExpandCompoundAssignmentTest, Increment_I32) {
auto* src = R"(
fn main() {
var v : i32;
v++;
}
)";
auto* expect = R"(
fn main() {
var v : i32;
v = (v + 1);
}
)";
auto got = Run<ExpandCompoundAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(ExpandCompoundAssignmentTest, Increment_U32) {
auto* src = R"(
fn main() {
var v : u32;
v++;
}
)";
auto* expect = R"(
fn main() {
var v : u32;
v = (v + 1u);
}
)";
auto got = Run<ExpandCompoundAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(ExpandCompoundAssignmentTest, Decrement_I32) {
auto* src = R"(
fn main() {
var v : i32;
v--;
}
)";
auto* expect = R"(
fn main() {
var v : i32;
v = (v - 1);
}
)";
auto got = Run<ExpandCompoundAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(ExpandCompoundAssignmentTest, Decrement_U32) {
auto* src = R"(
fn main() {
var v : u32;
v--;
}
)";
auto* expect = R"(
fn main() {
var v : u32;
v = (v - 1u);
}
)";
auto got = Run<ExpandCompoundAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(ExpandCompoundAssignmentTest, Increment_LhsPointer) {
auto* src = R"(
fn main() {
var v : i32;
let p = &v;
*p++;
}
)";
auto* expect = R"(
fn main() {
var v : i32;
let p = &(v);
let tint_symbol = &(*(p));
*(tint_symbol) = (*(tint_symbol) + 1);
}
)";
auto got = Run<ExpandCompoundAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(ExpandCompoundAssignmentTest, Increment_LhsStructMember) {
auto* src = R"(
struct S {
m : i32,
}
fn main() {
var s : S;
s.m++;
}
)";
auto* expect = R"(
struct S {
m : i32,
}
fn main() {
var s : S;
s.m = (s.m + 1);
}
)";
auto got = Run<ExpandCompoundAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(ExpandCompoundAssignmentTest, Increment_LhsArrayElement) {
auto* src = R"(
var<private> a : array<i32, 4>;
fn idx() -> i32 {
a[1] = 42;
return 1;
}
fn main() {
a[idx()]++;
}
)";
auto* expect = R"(
var<private> a : array<i32, 4>;
fn idx() -> i32 {
a[1] = 42;
return 1;
}
fn main() {
let tint_symbol = &(a[idx()]);
*(tint_symbol) = (*(tint_symbol) + 1);
}
)";
auto got = Run<ExpandCompoundAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(ExpandCompoundAssignmentTest,
Increment_LhsVectorComponent_ArrayAccessor) {
auto* src = R"(
var<private> v : vec4<i32>;
fn idx() -> i32 {
v.y = 42;
return 1;
}
fn main() {
v[idx()]++;
}
)";
auto* expect = R"(
var<private> v : vec4<i32>;
fn idx() -> i32 {
v.y = 42;
return 1;
}
fn main() {
let tint_symbol = &(v);
let tint_symbol_1 = idx();
(*(tint_symbol))[tint_symbol_1] = ((*(tint_symbol))[tint_symbol_1] + 1);
}
)";
auto got = Run<ExpandCompoundAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(ExpandCompoundAssignmentTest,
Increment_LhsVectorComponent_MemberAccessor) {
auto* src = R"(
fn main() {
var v : vec4<i32>;
v.y++;
}
)";
auto* expect = R"(
fn main() {
var v : vec4<i32>;
v.y = (v.y + 1);
}
)";
auto got = Run<ExpandCompoundAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(ExpandCompoundAssignmentTest, Increment_ForLoopCont) {
auto* src = R"(
var<private> a : array<vec4<i32>, 4>;
var<private> p : i32;
fn idx1() -> i32 {
p = (p + 1);
return 3;
}
fn idx2() -> i32 {
p = (p * 3);
return 2;
}
fn main() {
for (; ; a[idx1()][idx2()]++) {
break;
}
}
)";
auto* expect = R"(
var<private> a : array<vec4<i32>, 4>;
var<private> p : i32;
fn idx1() -> i32 {
p = (p + 1);
return 3;
}
fn idx2() -> i32 {
p = (p * 3);
return 2;
}
fn main() {
loop {
{
break;
}
continuing {
let tint_symbol = &(a[idx1()]);
let tint_symbol_1 = idx2();
(*(tint_symbol))[tint_symbol_1] = ((*(tint_symbol))[tint_symbol_1] + 1);
}
}
}
)";
auto got = Run<ExpandCompoundAssignment>(src);
EXPECT_EQ(expect, str(got));
}
} // namespace } // namespace
} // namespace transform } // namespace transform
} // namespace tint } // namespace tint

View File

@ -1,10 +1,13 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@group(0) @binding(0) var<storage, read_write> a : array<u32>; void unused_entry_point() {
return;
fn main() { }
a[1]--; layout(binding = 0, std430) buffer a_block_1 {
uint inner[];
} a;
void tint_symbol() {
a.inner[1] = (a.inner[1] - 1u);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,10 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
@group(0) @binding(0) var<storage, read_write> a : array<u32>;
fn main() {
a[1]--;
} }
Failed to generate: error: cannot modify value of type 'u32' RWByteAddressBuffer a : register(u0, space0);
void main() {
a.Store(4u, asuint((a.Load(4u) - 1u)));
}

View File

@ -1,10 +1,7 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
@group(0) @binding(0) var<storage, read_write> a : array<u32>; void tint_symbol(device uint (*const tint_symbol_2)[1]) {
(*(tint_symbol_2))[1] = ((*(tint_symbol_2))[1] - 1u);
fn tint_symbol() {
a[1]--;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,44 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
@group(0) @binding(0) var<storage, read_write> a : array<u32>; ; Bound: 21
; Schema: 0
fn main() { OpCapability Shader
a[1]--; OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpName %a_block "a_block"
OpMemberName %a_block 0 "inner"
OpName %a "a"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %a_block Block
OpMemberDecorate %a_block 0 Offset 0
OpDecorate %_runtimearr_uint ArrayStride 4
OpDecorate %a DescriptorSet 0
OpDecorate %a Binding 0
%uint = OpTypeInt 32 0
%_runtimearr_uint = OpTypeRuntimeArray %uint
%a_block = OpTypeStruct %_runtimearr_uint
%_ptr_StorageBuffer_a_block = OpTypePointer StorageBuffer %a_block
%a = OpVariable %_ptr_StorageBuffer_a_block StorageBuffer
%void = OpTypeVoid
%6 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%unused_entry_point = OpFunction %void None %6
%9 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %6
%11 = OpLabel
%16 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %int_1
%17 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %int_1
%18 = OpLoad %uint %17
%20 = OpISub %uint %18 %uint_1
OpStore %16 %20
OpReturn
OpFunctionEnd

View File

@ -1,47 +1,70 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
struct S { void unused_entry_point() {
a : array<vec4<i32>, 4>, return;
} }
struct S {
ivec4 a[4];
};
@group(0) @binding(0) var<storage, read_write> buffer : array<S>; layout(binding = 0, std430) buffer tint_symbol_block_1 {
S inner[];
var<private> v : u32; } tint_symbol;
uint v = 0u;
fn idx1() -> i32 { int idx1() {
v--; v = (v - 1u);
return 1; return 1;
} }
fn idx2() -> i32 { int idx2() {
v--; v = (v - 1u);
return 2; return 2;
} }
fn idx3() -> i32 { int idx3() {
v--; v = (v - 1u);
return 3; return 3;
} }
fn idx4() -> i32 { int idx4() {
v--; v = (v - 1u);
return 4; return 4;
} }
fn idx5() -> i32 { int idx5() {
v--; v = (v - 1u);
return 0; return 0;
} }
fn idx6() -> i32 { int idx6() {
v--; v = (v - 1u);
return 2; return 2;
} }
fn main() { void tint_symbol_1() {
for(buffer[idx1()].a[idx2()][idx3()]--; (v < 10u); buffer[idx4()].a[idx5()][idx6()]--) { int tint_symbol_6 = idx1();
int tint_symbol_7 = idx2();
int tint_symbol_2_save = tint_symbol_6;
int tint_symbol_2_save_1 = tint_symbol_7;
int tint_symbol_3 = idx3();
{
tint_symbol.inner[tint_symbol_2_save].a[tint_symbol_2_save_1][tint_symbol_3] = (tint_symbol.inner[tint_symbol_2_save].a[tint_symbol_2_save_1][tint_symbol_3] - 1);
while (true) {
if (!((v < 10u))) {
break;
}
{
}
{
int tint_symbol_8 = idx4();
int tint_symbol_9 = idx5();
int tint_symbol_4_save = tint_symbol_8;
int tint_symbol_4_save_1 = tint_symbol_9;
int tint_symbol_5 = idx6();
tint_symbol.inner[tint_symbol_4_save].a[tint_symbol_4_save_1][tint_symbol_5] = (tint_symbol.inner[tint_symbol_4_save].a[tint_symbol_4_save_1][tint_symbol_5] - 1);
}
}
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,47 +1,63 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
struct S {
a : array<vec4<i32>, 4>,
} }
@group(0) @binding(0) var<storage, read_write> buffer : array<S>; RWByteAddressBuffer buffer : register(u0, space0);
static uint v = 0u;
var<private> v : u32; int idx1() {
v = (v - 1u);
fn idx1() -> i32 {
v--;
return 1; return 1;
} }
fn idx2() -> i32 { int idx2() {
v--; v = (v - 1u);
return 2; return 2;
} }
fn idx3() -> i32 { int idx3() {
v--; v = (v - 1u);
return 3; return 3;
} }
fn idx4() -> i32 { int idx4() {
v--; v = (v - 1u);
return 4; return 4;
} }
fn idx5() -> i32 { int idx5() {
v--; v = (v - 1u);
return 0; return 0;
} }
fn idx6() -> i32 { int idx6() {
v--; v = (v - 1u);
return 2; return 2;
} }
fn main() { void main() {
for(buffer[idx1()].a[idx2()][idx3()]--; (v < 10u); buffer[idx4()].a[idx5()][idx6()]--) { const int tint_symbol_4 = idx1();
const int tint_symbol_5 = idx2();
const int tint_symbol_save = tint_symbol_4;
const int tint_symbol_save_1 = tint_symbol_5;
const int tint_symbol_1 = idx3();
{
buffer.Store((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))))) - 1)));
[loop] while (true) {
if (!((v < 10u))) {
break;
}
{
}
{
const int tint_symbol_6 = idx4();
const int tint_symbol_7 = idx5();
const int tint_symbol_2_save = tint_symbol_6;
const int tint_symbol_2_save_1 = tint_symbol_7;
const int tint_symbol_3 = idx6();
buffer.Store((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))))) - 1)));
}
}
} }
} }
Failed to generate: error: cannot modify value of type 'i32'

View File

@ -1,47 +1,67 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
/* 0x0000 */ int4 arr[4];
};
struct S { struct S {
a : array<vec4<i32>, 4>, /* 0x0000 */ tint_array_wrapper a;
} };
@group(0) @binding(0) var<storage, read_write> tint_symbol : array<S>; int idx1(thread uint* const tint_symbol_10) {
*(tint_symbol_10) = (*(tint_symbol_10) - 1u);
var<private> v : u32;
fn idx1() -> i32 {
v--;
return 1; return 1;
} }
fn idx2() -> i32 { int idx2(thread uint* const tint_symbol_11) {
v--; *(tint_symbol_11) = (*(tint_symbol_11) - 1u);
return 2; return 2;
} }
fn idx3() -> i32 { int idx3(thread uint* const tint_symbol_12) {
v--; *(tint_symbol_12) = (*(tint_symbol_12) - 1u);
return 3; return 3;
} }
fn idx4() -> i32 { int idx4(thread uint* const tint_symbol_13) {
v--; *(tint_symbol_13) = (*(tint_symbol_13) - 1u);
return 4; return 4;
} }
fn idx5() -> i32 { int idx5(thread uint* const tint_symbol_14) {
v--; *(tint_symbol_14) = (*(tint_symbol_14) - 1u);
return 0; return 0;
} }
fn idx6() -> i32 { int idx6(thread uint* const tint_symbol_15) {
v--; *(tint_symbol_15) = (*(tint_symbol_15) - 1u);
return 2; return 2;
} }
fn tint_symbol_1() { void tint_symbol_1(thread uint* const tint_symbol_16, device S (*const tint_symbol_17)[1]) {
for(tint_symbol[idx1()].a[idx2()][idx3()]--; (v < 10u); tint_symbol[idx4()].a[idx5()][idx6()]--) { int const tint_symbol_6 = idx1(tint_symbol_16);
int const tint_symbol_7 = idx2(tint_symbol_16);
int const tint_symbol_2_save = tint_symbol_6;
int const tint_symbol_2_save_1 = tint_symbol_7;
int const tint_symbol_3 = idx3(tint_symbol_16);
{
(*(tint_symbol_17))[tint_symbol_2_save].a.arr[tint_symbol_2_save_1][tint_symbol_3] = as_type<int>((as_type<uint>((*(tint_symbol_17))[tint_symbol_2_save].a.arr[tint_symbol_2_save_1][tint_symbol_3]) - as_type<uint>(1)));
while (true) {
if (!((*(tint_symbol_16) < 10u))) {
break;
}
{
}
{
int const tint_symbol_8 = idx4(tint_symbol_16);
int const tint_symbol_9 = idx5(tint_symbol_16);
int const tint_symbol_4_save = tint_symbol_8;
int const tint_symbol_4_save_1 = tint_symbol_9;
int const tint_symbol_5 = idx6(tint_symbol_16);
(*(tint_symbol_17))[tint_symbol_4_save].a.arr[tint_symbol_4_save_1][tint_symbol_5] = as_type<int>((as_type<uint>((*(tint_symbol_17))[tint_symbol_4_save].a.arr[tint_symbol_4_save_1][tint_symbol_5]) - as_type<uint>(1)));
}
}
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,47 +1,139 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
struct S { ; Bound: 78
a : array<vec4<i32>, 4>, ; Schema: 0
} OpCapability Shader
OpMemoryModel Logical GLSL450
@group(0) @binding(0) var<storage, read_write> buffer : array<S>; OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
var<private> v : u32; OpName %buffer_block "buffer_block"
OpMemberName %buffer_block 0 "inner"
fn idx1() -> i32 { OpName %S "S"
v--; OpMemberName %S 0 "a"
return 1; OpName %buffer "buffer"
} OpName %v "v"
OpName %unused_entry_point "unused_entry_point"
fn idx2() -> i32 { OpName %idx1 "idx1"
v--; OpName %idx2 "idx2"
return 2; OpName %idx3 "idx3"
} OpName %idx4 "idx4"
OpName %idx5 "idx5"
fn idx3() -> i32 { OpName %idx6 "idx6"
v--; OpName %main "main"
return 3; OpDecorate %buffer_block Block
} OpMemberDecorate %buffer_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0
fn idx4() -> i32 { OpDecorate %_arr_v4int_uint_4 ArrayStride 16
v--; OpDecorate %_runtimearr_S ArrayStride 64
return 4; OpDecorate %buffer DescriptorSet 0
} OpDecorate %buffer Binding 0
%int = OpTypeInt 32 1
fn idx5() -> i32 { %v4int = OpTypeVector %int 4
v--; %uint = OpTypeInt 32 0
return 0; %uint_4 = OpConstant %uint 4
} %_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
%S = OpTypeStruct %_arr_v4int_uint_4
fn idx6() -> i32 { %_runtimearr_S = OpTypeRuntimeArray %S
v--; %buffer_block = OpTypeStruct %_runtimearr_S
return 2; %_ptr_StorageBuffer_buffer_block = OpTypePointer StorageBuffer %buffer_block
} %buffer = OpVariable %_ptr_StorageBuffer_buffer_block StorageBuffer
%_ptr_Private_uint = OpTypePointer Private %uint
fn main() { %13 = OpConstantNull %uint
for(buffer[idx1()].a[idx2()][idx3()]--; (v < 10u); buffer[idx4()].a[idx5()][idx6()]--) { %v = OpVariable %_ptr_Private_uint Private %13
} %void = OpTypeVoid
} %14 = OpTypeFunction %void
%18 = OpTypeFunction %int
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement %uint_1 = OpConstant %uint 1
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_4 = OpConstant %int 4
%int_0 = OpConstant %int 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%uint_10 = OpConstant %uint 10
%bool = OpTypeBool
%unused_entry_point = OpFunction %void None %14
%17 = OpLabel
OpReturn
OpFunctionEnd
%idx1 = OpFunction %int None %18
%20 = OpLabel
%21 = OpLoad %uint %v
%23 = OpISub %uint %21 %uint_1
OpStore %v %23
OpReturnValue %int_1
OpFunctionEnd
%idx2 = OpFunction %int None %18
%26 = OpLabel
%27 = OpLoad %uint %v
%28 = OpISub %uint %27 %uint_1
OpStore %v %28
OpReturnValue %int_2
OpFunctionEnd
%idx3 = OpFunction %int None %18
%31 = OpLabel
%32 = OpLoad %uint %v
%33 = OpISub %uint %32 %uint_1
OpStore %v %33
OpReturnValue %int_3
OpFunctionEnd
%idx4 = OpFunction %int None %18
%36 = OpLabel
%37 = OpLoad %uint %v
%38 = OpISub %uint %37 %uint_1
OpStore %v %38
OpReturnValue %int_4
OpFunctionEnd
%idx5 = OpFunction %int None %18
%41 = OpLabel
%42 = OpLoad %uint %v
%43 = OpISub %uint %42 %uint_1
OpStore %v %43
OpReturnValue %int_0
OpFunctionEnd
%idx6 = OpFunction %int None %18
%46 = OpLabel
%47 = OpLoad %uint %v
%48 = OpISub %uint %47 %uint_1
OpStore %v %48
OpReturnValue %int_2
OpFunctionEnd
%main = OpFunction %void None %14
%50 = OpLabel
%51 = OpFunctionCall %int %idx1
%52 = OpFunctionCall %int %idx2
%53 = OpFunctionCall %int %idx3
%56 = OpAccessChain %_ptr_StorageBuffer_int %buffer %uint_0 %51 %uint_0 %52 %53
%57 = OpAccessChain %_ptr_StorageBuffer_int %buffer %uint_0 %51 %uint_0 %52 %53
%58 = OpLoad %int %57
%59 = OpISub %int %58 %int_1
OpStore %56 %59
OpBranch %60
%60 = OpLabel
OpLoopMerge %61 %62 None
OpBranch %63
%63 = OpLabel
%65 = OpLoad %uint %v
%67 = OpULessThan %bool %65 %uint_10
%64 = OpLogicalNot %bool %67
OpSelectionMerge %69 None
OpBranchConditional %64 %70 %69
%70 = OpLabel
OpBranch %61
%69 = OpLabel
OpBranch %62
%62 = OpLabel
%71 = OpFunctionCall %int %idx4
%72 = OpFunctionCall %int %idx5
%73 = OpFunctionCall %int %idx6
%74 = OpAccessChain %_ptr_StorageBuffer_int %buffer %uint_0 %71 %uint_0 %72 %73
%75 = OpAccessChain %_ptr_StorageBuffer_int %buffer %uint_0 %71 %uint_0 %72 %73
%76 = OpLoad %int %75
%77 = OpISub %int %76 %int_1
OpStore %74 %77
OpBranch %60
%61 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -1,11 +1,20 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct i_block {
uint inner;
};
@group(0) @binding(0) var<storage, read_write> i : u32; layout(binding = 0, std430) buffer i_block_1 {
uint inner;
fn main() { } i;
for(; (i < 10u); i--) { void tint_symbol() {
{
for(; (i.inner < 10u); i.inner = (i.inner - 1u)) {
}
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,13 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
@group(0) @binding(0) var<storage, read_write> i : u32;
fn main() {
for(; (i < 10u); i--) {
}
} }
Failed to generate: error: cannot modify value of type 'u32' RWByteAddressBuffer i : register(u0, space0);
void main() {
{
[loop] for(; (i.Load(0u) < 10u); i.Store(0u, asuint((i.Load(0u) - 1u)))) {
}
}
}

View File

@ -1,11 +1,8 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
@group(0) @binding(0) var<storage, read_write> i : u32; void tint_symbol(device uint* const tint_symbol_1) {
for(; (*(tint_symbol_1) < 10u); *(tint_symbol_1) = (*(tint_symbol_1) - 1u)) {
fn tint_symbol() {
for(; (i < 10u); i--) {
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,60 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
@group(0) @binding(0) var<storage, read_write> i : u32; ; Bound: 30
; Schema: 0
fn main() { OpCapability Shader
for(; (i < 10u); i--) { OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
} OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %i_block "i_block"
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpMemberName %i_block 0 "inner"
OpName %i "i"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %i_block Block
OpMemberDecorate %i_block 0 Offset 0
OpDecorate %i DescriptorSet 0
OpDecorate %i Binding 0
%uint = OpTypeInt 32 0
%i_block = OpTypeStruct %uint
%_ptr_StorageBuffer_i_block = OpTypePointer StorageBuffer %i_block
%i = OpVariable %_ptr_StorageBuffer_i_block StorageBuffer
%void = OpTypeVoid
%5 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_10 = OpConstant %uint 10
%bool = OpTypeBool
%uint_1 = OpConstant %uint 1
%unused_entry_point = OpFunction %void None %5
%8 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %5
%10 = OpLabel
OpBranch %11
%11 = OpLabel
OpLoopMerge %12 %13 None
OpBranch %14
%14 = OpLabel
%18 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%19 = OpLoad %uint %18
%21 = OpULessThan %bool %19 %uint_10
%15 = OpLogicalNot %bool %21
OpSelectionMerge %23 None
OpBranchConditional %15 %24 %23
%24 = OpLabel
OpBranch %12
%23 = OpLabel
OpBranch %13
%13 = OpLabel
%25 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%26 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%27 = OpLoad %uint %26
%29 = OpISub %uint %27 %uint_1
OpStore %25 %29
OpBranch %11
%12 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -1,11 +1,20 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct i_block {
uint inner;
};
@group(0) @binding(0) var<storage, read_write> i : u32; layout(binding = 0, std430) buffer i_block_1 {
uint inner;
fn main() { } i;
for(i--; (i < 10u); ) { void tint_symbol() {
{
for(i.inner = (i.inner - 1u); (i.inner < 10u); ) {
}
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,13 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
@group(0) @binding(0) var<storage, read_write> i : u32;
fn main() {
for(i--; (i < 10u); ) {
}
} }
Failed to generate: error: cannot modify value of type 'u32' RWByteAddressBuffer i : register(u0, space0);
void main() {
{
[loop] for(i.Store(0u, asuint((i.Load(0u) - 1u))); (i.Load(0u) < 10u); ) {
}
}
}

View File

@ -1,11 +1,8 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
@group(0) @binding(0) var<storage, read_write> i : u32; void tint_symbol(device uint* const tint_symbol_1) {
for(*(tint_symbol_1) = (*(tint_symbol_1) - 1u); (*(tint_symbol_1) < 10u); ) {
fn tint_symbol() {
for(i--; (i < 10u); ) {
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,60 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
@group(0) @binding(0) var<storage, read_write> i : u32; ; Bound: 30
; Schema: 0
fn main() { OpCapability Shader
for(i--; (i < 10u); ) { OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
} OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %i_block "i_block"
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpMemberName %i_block 0 "inner"
OpName %i "i"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %i_block Block
OpMemberDecorate %i_block 0 Offset 0
OpDecorate %i DescriptorSet 0
OpDecorate %i Binding 0
%uint = OpTypeInt 32 0
%i_block = OpTypeStruct %uint
%_ptr_StorageBuffer_i_block = OpTypePointer StorageBuffer %i_block
%i = OpVariable %_ptr_StorageBuffer_i_block StorageBuffer
%void = OpTypeVoid
%5 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%uint_10 = OpConstant %uint 10
%bool = OpTypeBool
%unused_entry_point = OpFunction %void None %5
%8 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %5
%10 = OpLabel
%13 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%14 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%15 = OpLoad %uint %14
%17 = OpISub %uint %15 %uint_1
OpStore %13 %17
OpBranch %18
%18 = OpLabel
OpLoopMerge %19 %20 None
OpBranch %21
%21 = OpLabel
%23 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%24 = OpLoad %uint %23
%26 = OpULessThan %bool %24 %uint_10
%22 = OpLogicalNot %bool %26
OpSelectionMerge %28 None
OpBranchConditional %22 %29 %28
%29 = OpLabel
OpBranch %19
%28 = OpLabel
OpBranch %20
%20 = OpLabel
OpBranch %18
%19 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -1,9 +1,11 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
fn main() { void unused_entry_point() {
var i = 0; return;
i--; }
void tint_symbol() {
int i = 0;
i = (i - 1);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,9 +1,9 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
fn main() {
var i = 0;
i--;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement void main() {
int i = 0;
i = (i - 1);
}

View File

@ -1,9 +1,8 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
fn tint_symbol() { void tint_symbol() {
var i = 0; int i = 0;
i--; i = as_type<int>((as_type<uint>(i) - as_type<uint>(1)));
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,9 +1,32 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
fn main() { ; Bound: 15
var i = 0; ; Schema: 0
i--; OpCapability Shader
} OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpName %i "i"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Function_int = OpTypePointer Function %int
%11 = OpConstantNull %int
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%6 = OpLabel
%i = OpVariable %_ptr_Function_int Function %11
OpStore %i %int_0
%12 = OpLoad %int %i
%14 = OpISub %int %12 %int_1
OpStore %i %14
OpReturn
OpFunctionEnd

View File

@ -1,10 +1,11 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
var<private> i : i32 = 0; void unused_entry_point() {
return;
fn main() { }
i--; int i = 0;
void tint_symbol() {
i = (i - 1);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,10 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
var<private> i : i32 = 0;
fn main() {
i--;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement static int i = 0;
void main() {
i = (i - 1);
}

View File

@ -1,10 +1,7 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
var<private> i : i32 = 0; void tint_symbol(thread int* const tint_symbol_1) {
*(tint_symbol_1) = as_type<int>((as_type<uint>(*(tint_symbol_1)) - as_type<uint>(1)));
fn tint_symbol() {
i--;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,30 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
var<private> i : i32 = 0; ; Bound: 14
; Schema: 0
fn main() { OpCapability Shader
i--; OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpName %i "i"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Private_int = OpTypePointer Private %int
%i = OpVariable %_ptr_Private_int Private %int_0
%void = OpTypeVoid
%5 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %5
%8 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %5
%10 = OpLabel
%11 = OpLoad %int %i
%13 = OpISub %int %11 %int_1
OpStore %i %13
OpReturn
OpFunctionEnd

View File

@ -1,10 +1,17 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct i_block {
uint inner;
};
@group(0) @binding(0) var<storage, read_write> i : u32; layout(binding = 0, std430) buffer i_block_1 {
uint inner;
fn main() { } i;
i--; void tint_symbol() {
i.inner = (i.inner - 1u);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,10 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
@group(0) @binding(0) var<storage, read_write> i : u32;
fn main() {
i--;
} }
Failed to generate: error: cannot modify value of type 'u32' RWByteAddressBuffer i : register(u0, space0);
void main() {
i.Store(0u, asuint((i.Load(0u) - 1u)));
}

View File

@ -1,10 +1,7 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
@group(0) @binding(0) var<storage, read_write> i : u32; void tint_symbol(device uint* const tint_symbol_1) {
*(tint_symbol_1) = (*(tint_symbol_1) - 1u);
fn tint_symbol() {
i--;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,40 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
@group(0) @binding(0) var<storage, read_write> i : u32; ; Bound: 18
; Schema: 0
fn main() { OpCapability Shader
i--; OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpName %i_block "i_block"
OpMemberName %i_block 0 "inner"
OpName %i "i"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %i_block Block
OpMemberDecorate %i_block 0 Offset 0
OpDecorate %i DescriptorSet 0
OpDecorate %i Binding 0
%uint = OpTypeInt 32 0
%i_block = OpTypeStruct %uint
%_ptr_StorageBuffer_i_block = OpTypePointer StorageBuffer %i_block
%i = OpVariable %_ptr_StorageBuffer_i_block StorageBuffer
%void = OpTypeVoid
%5 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%unused_entry_point = OpFunction %void None %5
%8 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %5
%10 = OpLabel
%13 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%14 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%15 = OpLoad %uint %14
%17 = OpISub %uint %15 %uint_1
OpStore %13 %17
OpReturn
OpFunctionEnd

View File

@ -1,11 +1,19 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct a_block {
uvec4 inner;
};
@group(0) @binding(0) var<storage, read_write> a : vec4<u32>; layout(binding = 0, std430) buffer a_block_1 {
uvec4 inner;
fn main() { } a;
a[1]--; void tint_symbol() {
a.z--; int tint_symbol_2 = 1;
a.inner[tint_symbol_2] = (a.inner[tint_symbol_2] - 1u);
a.inner.z = (a.inner.z - 1u);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,12 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
@group(0) @binding(0) var<storage, read_write> a : vec4<u32>;
fn main() {
a[1]--;
a.z--;
} }
Failed to generate: error: cannot modify value of type 'u32' RWByteAddressBuffer a : register(u0, space0);
void main() {
const int tint_symbol_1 = 1;
a.Store((4u * uint(tint_symbol_1)), asuint((a.Load((4u * uint(tint_symbol_1))) - 1u)));
a.Store(8u, asuint((a.Load(8u) - 1u)));
}

View File

@ -1,11 +1,9 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
@group(0) @binding(0) var<storage, read_write> a : vec4<u32>; void tint_symbol(device uint4* const tint_symbol_3) {
int const tint_symbol_2 = 1;
fn tint_symbol() { (*(tint_symbol_3))[tint_symbol_2] = ((*(tint_symbol_3))[tint_symbol_2] - 1u);
a[1]--; (*(tint_symbol_3))[2] = ((*(tint_symbol_3))[2] - 1u);
a.z--;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,49 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
@group(0) @binding(0) var<storage, read_write> a : vec4<u32>; ; Bound: 26
; Schema: 0
fn main() { OpCapability Shader
a[1]--; OpMemoryModel Logical GLSL450
a.z--; OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
} OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %a_block "a_block"
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpMemberName %a_block 0 "inner"
OpName %a "a"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %a_block Block
OpMemberDecorate %a_block 0 Offset 0
OpDecorate %a DescriptorSet 0
OpDecorate %a Binding 0
%uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4
%a_block = OpTypeStruct %v4uint
%_ptr_StorageBuffer_a_block = OpTypePointer StorageBuffer %a_block
%a = OpVariable %_ptr_StorageBuffer_a_block StorageBuffer
%void = OpTypeVoid
%6 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%unused_entry_point = OpFunction %void None %6
%9 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %6
%11 = OpLabel
%16 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %int_1
%17 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %int_1
%18 = OpLoad %uint %17
%20 = OpISub %uint %18 %uint_1
OpStore %16 %20
%22 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %uint_2
%23 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %uint_2
%24 = OpLoad %uint %23
%25 = OpISub %uint %24 %uint_1
OpStore %22 %25
OpReturn
OpFunctionEnd

View File

@ -1,10 +1,11 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
var<workgroup> i : i32; void unused_entry_point() {
return;
fn main() { }
i--; shared int i;
void tint_symbol() {
i = (i - 1);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,10 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
var<workgroup> i : i32;
fn main() {
i--;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement groupshared int i;
void main() {
i = (i - 1);
}

View File

@ -1,10 +1,7 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
var<workgroup> i : i32; void tint_symbol(threadgroup int* const tint_symbol_1) {
*(tint_symbol_1) = as_type<int>((as_type<uint>(*(tint_symbol_1)) - as_type<uint>(1)));
fn tint_symbol() {
i--;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,29 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
var<workgroup> i : i32; ; Bound: 13
; Schema: 0
fn main() { OpCapability Shader
i--; OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpName %i "i"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
%int = OpTypeInt 32 1
%_ptr_Workgroup_int = OpTypePointer Workgroup %int
%i = OpVariable %_ptr_Workgroup_int Workgroup
%void = OpTypeVoid
%4 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %4
%7 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %4
%9 = OpLabel
%10 = OpLoad %int %i
%12 = OpISub %int %10 %int_1
OpStore %i %12
OpReturn
OpFunctionEnd

View File

@ -1,10 +1,13 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@group(0) @binding(0) var<storage, read_write> a : array<u32>; void unused_entry_point() {
return;
fn main() { }
a[1]++; layout(binding = 0, std430) buffer a_block_1 {
uint inner[];
} a;
void tint_symbol() {
a.inner[1] = (a.inner[1] + 1u);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,10 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
@group(0) @binding(0) var<storage, read_write> a : array<u32>;
fn main() {
a[1]++;
} }
Failed to generate: error: cannot modify value of type 'u32' RWByteAddressBuffer a : register(u0, space0);
void main() {
a.Store(4u, asuint((a.Load(4u) + 1u)));
}

View File

@ -1,10 +1,7 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
@group(0) @binding(0) var<storage, read_write> a : array<u32>; void tint_symbol(device uint (*const tint_symbol_2)[1]) {
(*(tint_symbol_2))[1] = ((*(tint_symbol_2))[1] + 1u);
fn tint_symbol() {
a[1]++;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,44 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
@group(0) @binding(0) var<storage, read_write> a : array<u32>; ; Bound: 21
; Schema: 0
fn main() { OpCapability Shader
a[1]++; OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpName %a_block "a_block"
OpMemberName %a_block 0 "inner"
OpName %a "a"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %a_block Block
OpMemberDecorate %a_block 0 Offset 0
OpDecorate %_runtimearr_uint ArrayStride 4
OpDecorate %a DescriptorSet 0
OpDecorate %a Binding 0
%uint = OpTypeInt 32 0
%_runtimearr_uint = OpTypeRuntimeArray %uint
%a_block = OpTypeStruct %_runtimearr_uint
%_ptr_StorageBuffer_a_block = OpTypePointer StorageBuffer %a_block
%a = OpVariable %_ptr_StorageBuffer_a_block StorageBuffer
%void = OpTypeVoid
%6 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%unused_entry_point = OpFunction %void None %6
%9 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %6
%11 = OpLabel
%16 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %int_1
%17 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %int_1
%18 = OpLoad %uint %17
%20 = OpIAdd %uint %18 %uint_1
OpStore %16 %20
OpReturn
OpFunctionEnd

View File

@ -1,47 +1,70 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
struct S { void unused_entry_point() {
a : array<vec4<i32>, 4>, return;
} }
struct S {
ivec4 a[4];
};
@group(0) @binding(0) var<storage, read_write> buffer : array<S>; layout(binding = 0, std430) buffer tint_symbol_block_1 {
S inner[];
var<private> v : u32; } tint_symbol;
uint v = 0u;
fn idx1() -> i32 { int idx1() {
v++; v = (v + 1u);
return 1; return 1;
} }
fn idx2() -> i32 { int idx2() {
v++; v = (v + 1u);
return 2; return 2;
} }
fn idx3() -> i32 { int idx3() {
v++; v = (v + 1u);
return 3; return 3;
} }
fn idx4() -> i32 { int idx4() {
v++; v = (v + 1u);
return 4; return 4;
} }
fn idx5() -> i32 { int idx5() {
v++; v = (v + 1u);
return 0; return 0;
} }
fn idx6() -> i32 { int idx6() {
v++; v = (v + 1u);
return 2; return 2;
} }
fn main() { void tint_symbol_1() {
for(buffer[idx1()].a[idx2()][idx3()]++; (v < 10u); buffer[idx4()].a[idx5()][idx6()]++) { int tint_symbol_6 = idx1();
int tint_symbol_7 = idx2();
int tint_symbol_2_save = tint_symbol_6;
int tint_symbol_2_save_1 = tint_symbol_7;
int tint_symbol_3 = idx3();
{
tint_symbol.inner[tint_symbol_2_save].a[tint_symbol_2_save_1][tint_symbol_3] = (tint_symbol.inner[tint_symbol_2_save].a[tint_symbol_2_save_1][tint_symbol_3] + 1);
while (true) {
if (!((v < 10u))) {
break;
}
{
}
{
int tint_symbol_8 = idx4();
int tint_symbol_9 = idx5();
int tint_symbol_4_save = tint_symbol_8;
int tint_symbol_4_save_1 = tint_symbol_9;
int tint_symbol_5 = idx6();
tint_symbol.inner[tint_symbol_4_save].a[tint_symbol_4_save_1][tint_symbol_5] = (tint_symbol.inner[tint_symbol_4_save].a[tint_symbol_4_save_1][tint_symbol_5] + 1);
}
}
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,47 +1,63 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
struct S {
a : array<vec4<i32>, 4>,
} }
@group(0) @binding(0) var<storage, read_write> buffer : array<S>; RWByteAddressBuffer buffer : register(u0, space0);
static uint v = 0u;
var<private> v : u32; int idx1() {
v = (v + 1u);
fn idx1() -> i32 {
v++;
return 1; return 1;
} }
fn idx2() -> i32 { int idx2() {
v++; v = (v + 1u);
return 2; return 2;
} }
fn idx3() -> i32 { int idx3() {
v++; v = (v + 1u);
return 3; return 3;
} }
fn idx4() -> i32 { int idx4() {
v++; v = (v + 1u);
return 4; return 4;
} }
fn idx5() -> i32 { int idx5() {
v++; v = (v + 1u);
return 0; return 0;
} }
fn idx6() -> i32 { int idx6() {
v++; v = (v + 1u);
return 2; return 2;
} }
fn main() { void main() {
for(buffer[idx1()].a[idx2()][idx3()]++; (v < 10u); buffer[idx4()].a[idx5()][idx6()]++) { const int tint_symbol_4 = idx1();
const int tint_symbol_5 = idx2();
const int tint_symbol_save = tint_symbol_4;
const int tint_symbol_save_1 = tint_symbol_5;
const int tint_symbol_1 = idx3();
{
buffer.Store((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))))) + 1)));
[loop] while (true) {
if (!((v < 10u))) {
break;
}
{
}
{
const int tint_symbol_6 = idx4();
const int tint_symbol_7 = idx5();
const int tint_symbol_2_save = tint_symbol_6;
const int tint_symbol_2_save_1 = tint_symbol_7;
const int tint_symbol_3 = idx6();
buffer.Store((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))))) + 1)));
}
}
} }
} }
Failed to generate: error: cannot modify value of type 'i32'

View File

@ -1,47 +1,67 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
/* 0x0000 */ int4 arr[4];
};
struct S { struct S {
a : array<vec4<i32>, 4>, /* 0x0000 */ tint_array_wrapper a;
} };
@group(0) @binding(0) var<storage, read_write> tint_symbol : array<S>; int idx1(thread uint* const tint_symbol_10) {
*(tint_symbol_10) = (*(tint_symbol_10) + 1u);
var<private> v : u32;
fn idx1() -> i32 {
v++;
return 1; return 1;
} }
fn idx2() -> i32 { int idx2(thread uint* const tint_symbol_11) {
v++; *(tint_symbol_11) = (*(tint_symbol_11) + 1u);
return 2; return 2;
} }
fn idx3() -> i32 { int idx3(thread uint* const tint_symbol_12) {
v++; *(tint_symbol_12) = (*(tint_symbol_12) + 1u);
return 3; return 3;
} }
fn idx4() -> i32 { int idx4(thread uint* const tint_symbol_13) {
v++; *(tint_symbol_13) = (*(tint_symbol_13) + 1u);
return 4; return 4;
} }
fn idx5() -> i32 { int idx5(thread uint* const tint_symbol_14) {
v++; *(tint_symbol_14) = (*(tint_symbol_14) + 1u);
return 0; return 0;
} }
fn idx6() -> i32 { int idx6(thread uint* const tint_symbol_15) {
v++; *(tint_symbol_15) = (*(tint_symbol_15) + 1u);
return 2; return 2;
} }
fn tint_symbol_1() { void tint_symbol_1(thread uint* const tint_symbol_16, device S (*const tint_symbol_17)[1]) {
for(tint_symbol[idx1()].a[idx2()][idx3()]++; (v < 10u); tint_symbol[idx4()].a[idx5()][idx6()]++) { int const tint_symbol_6 = idx1(tint_symbol_16);
int const tint_symbol_7 = idx2(tint_symbol_16);
int const tint_symbol_2_save = tint_symbol_6;
int const tint_symbol_2_save_1 = tint_symbol_7;
int const tint_symbol_3 = idx3(tint_symbol_16);
{
(*(tint_symbol_17))[tint_symbol_2_save].a.arr[tint_symbol_2_save_1][tint_symbol_3] = as_type<int>((as_type<uint>((*(tint_symbol_17))[tint_symbol_2_save].a.arr[tint_symbol_2_save_1][tint_symbol_3]) + as_type<uint>(1)));
while (true) {
if (!((*(tint_symbol_16) < 10u))) {
break;
}
{
}
{
int const tint_symbol_8 = idx4(tint_symbol_16);
int const tint_symbol_9 = idx5(tint_symbol_16);
int const tint_symbol_4_save = tint_symbol_8;
int const tint_symbol_4_save_1 = tint_symbol_9;
int const tint_symbol_5 = idx6(tint_symbol_16);
(*(tint_symbol_17))[tint_symbol_4_save].a.arr[tint_symbol_4_save_1][tint_symbol_5] = as_type<int>((as_type<uint>((*(tint_symbol_17))[tint_symbol_4_save].a.arr[tint_symbol_4_save_1][tint_symbol_5]) + as_type<uint>(1)));
}
}
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,47 +1,139 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
struct S { ; Bound: 78
a : array<vec4<i32>, 4>, ; Schema: 0
} OpCapability Shader
OpMemoryModel Logical GLSL450
@group(0) @binding(0) var<storage, read_write> buffer : array<S>; OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
var<private> v : u32; OpName %buffer_block "buffer_block"
OpMemberName %buffer_block 0 "inner"
fn idx1() -> i32 { OpName %S "S"
v++; OpMemberName %S 0 "a"
return 1; OpName %buffer "buffer"
} OpName %v "v"
OpName %unused_entry_point "unused_entry_point"
fn idx2() -> i32 { OpName %idx1 "idx1"
v++; OpName %idx2 "idx2"
return 2; OpName %idx3 "idx3"
} OpName %idx4 "idx4"
OpName %idx5 "idx5"
fn idx3() -> i32 { OpName %idx6 "idx6"
v++; OpName %main "main"
return 3; OpDecorate %buffer_block Block
} OpMemberDecorate %buffer_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0
fn idx4() -> i32 { OpDecorate %_arr_v4int_uint_4 ArrayStride 16
v++; OpDecorate %_runtimearr_S ArrayStride 64
return 4; OpDecorate %buffer DescriptorSet 0
} OpDecorate %buffer Binding 0
%int = OpTypeInt 32 1
fn idx5() -> i32 { %v4int = OpTypeVector %int 4
v++; %uint = OpTypeInt 32 0
return 0; %uint_4 = OpConstant %uint 4
} %_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
%S = OpTypeStruct %_arr_v4int_uint_4
fn idx6() -> i32 { %_runtimearr_S = OpTypeRuntimeArray %S
v++; %buffer_block = OpTypeStruct %_runtimearr_S
return 2; %_ptr_StorageBuffer_buffer_block = OpTypePointer StorageBuffer %buffer_block
} %buffer = OpVariable %_ptr_StorageBuffer_buffer_block StorageBuffer
%_ptr_Private_uint = OpTypePointer Private %uint
fn main() { %13 = OpConstantNull %uint
for(buffer[idx1()].a[idx2()][idx3()]++; (v < 10u); buffer[idx4()].a[idx5()][idx6()]++) { %v = OpVariable %_ptr_Private_uint Private %13
} %void = OpTypeVoid
} %14 = OpTypeFunction %void
%18 = OpTypeFunction %int
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement %uint_1 = OpConstant %uint 1
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_4 = OpConstant %int 4
%int_0 = OpConstant %int 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%uint_10 = OpConstant %uint 10
%bool = OpTypeBool
%unused_entry_point = OpFunction %void None %14
%17 = OpLabel
OpReturn
OpFunctionEnd
%idx1 = OpFunction %int None %18
%20 = OpLabel
%21 = OpLoad %uint %v
%23 = OpIAdd %uint %21 %uint_1
OpStore %v %23
OpReturnValue %int_1
OpFunctionEnd
%idx2 = OpFunction %int None %18
%26 = OpLabel
%27 = OpLoad %uint %v
%28 = OpIAdd %uint %27 %uint_1
OpStore %v %28
OpReturnValue %int_2
OpFunctionEnd
%idx3 = OpFunction %int None %18
%31 = OpLabel
%32 = OpLoad %uint %v
%33 = OpIAdd %uint %32 %uint_1
OpStore %v %33
OpReturnValue %int_3
OpFunctionEnd
%idx4 = OpFunction %int None %18
%36 = OpLabel
%37 = OpLoad %uint %v
%38 = OpIAdd %uint %37 %uint_1
OpStore %v %38
OpReturnValue %int_4
OpFunctionEnd
%idx5 = OpFunction %int None %18
%41 = OpLabel
%42 = OpLoad %uint %v
%43 = OpIAdd %uint %42 %uint_1
OpStore %v %43
OpReturnValue %int_0
OpFunctionEnd
%idx6 = OpFunction %int None %18
%46 = OpLabel
%47 = OpLoad %uint %v
%48 = OpIAdd %uint %47 %uint_1
OpStore %v %48
OpReturnValue %int_2
OpFunctionEnd
%main = OpFunction %void None %14
%50 = OpLabel
%51 = OpFunctionCall %int %idx1
%52 = OpFunctionCall %int %idx2
%53 = OpFunctionCall %int %idx3
%56 = OpAccessChain %_ptr_StorageBuffer_int %buffer %uint_0 %51 %uint_0 %52 %53
%57 = OpAccessChain %_ptr_StorageBuffer_int %buffer %uint_0 %51 %uint_0 %52 %53
%58 = OpLoad %int %57
%59 = OpIAdd %int %58 %int_1
OpStore %56 %59
OpBranch %60
%60 = OpLabel
OpLoopMerge %61 %62 None
OpBranch %63
%63 = OpLabel
%65 = OpLoad %uint %v
%67 = OpULessThan %bool %65 %uint_10
%64 = OpLogicalNot %bool %67
OpSelectionMerge %69 None
OpBranchConditional %64 %70 %69
%70 = OpLabel
OpBranch %61
%69 = OpLabel
OpBranch %62
%62 = OpLabel
%71 = OpFunctionCall %int %idx4
%72 = OpFunctionCall %int %idx5
%73 = OpFunctionCall %int %idx6
%74 = OpAccessChain %_ptr_StorageBuffer_int %buffer %uint_0 %71 %uint_0 %72 %73
%75 = OpAccessChain %_ptr_StorageBuffer_int %buffer %uint_0 %71 %uint_0 %72 %73
%76 = OpLoad %int %75
%77 = OpIAdd %int %76 %int_1
OpStore %74 %77
OpBranch %60
%61 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -1,11 +1,20 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct i_block {
uint inner;
};
@group(0) @binding(0) var<storage, read_write> i : u32; layout(binding = 0, std430) buffer i_block_1 {
uint inner;
fn main() { } i;
for(; (i < 10u); i++) { void tint_symbol() {
{
for(; (i.inner < 10u); i.inner = (i.inner + 1u)) {
}
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,13 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
@group(0) @binding(0) var<storage, read_write> i : u32;
fn main() {
for(; (i < 10u); i++) {
}
} }
Failed to generate: error: cannot modify value of type 'u32' RWByteAddressBuffer i : register(u0, space0);
void main() {
{
[loop] for(; (i.Load(0u) < 10u); i.Store(0u, asuint((i.Load(0u) + 1u)))) {
}
}
}

View File

@ -1,11 +1,8 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
@group(0) @binding(0) var<storage, read_write> i : u32; void tint_symbol(device uint* const tint_symbol_1) {
for(; (*(tint_symbol_1) < 10u); *(tint_symbol_1) = (*(tint_symbol_1) + 1u)) {
fn tint_symbol() {
for(; (i < 10u); i++) {
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,60 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
@group(0) @binding(0) var<storage, read_write> i : u32; ; Bound: 30
; Schema: 0
fn main() { OpCapability Shader
for(; (i < 10u); i++) { OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
} OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %i_block "i_block"
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpMemberName %i_block 0 "inner"
OpName %i "i"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %i_block Block
OpMemberDecorate %i_block 0 Offset 0
OpDecorate %i DescriptorSet 0
OpDecorate %i Binding 0
%uint = OpTypeInt 32 0
%i_block = OpTypeStruct %uint
%_ptr_StorageBuffer_i_block = OpTypePointer StorageBuffer %i_block
%i = OpVariable %_ptr_StorageBuffer_i_block StorageBuffer
%void = OpTypeVoid
%5 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_10 = OpConstant %uint 10
%bool = OpTypeBool
%uint_1 = OpConstant %uint 1
%unused_entry_point = OpFunction %void None %5
%8 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %5
%10 = OpLabel
OpBranch %11
%11 = OpLabel
OpLoopMerge %12 %13 None
OpBranch %14
%14 = OpLabel
%18 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%19 = OpLoad %uint %18
%21 = OpULessThan %bool %19 %uint_10
%15 = OpLogicalNot %bool %21
OpSelectionMerge %23 None
OpBranchConditional %15 %24 %23
%24 = OpLabel
OpBranch %12
%23 = OpLabel
OpBranch %13
%13 = OpLabel
%25 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%26 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%27 = OpLoad %uint %26
%29 = OpIAdd %uint %27 %uint_1
OpStore %25 %29
OpBranch %11
%12 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -1,11 +1,20 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct i_block {
uint inner;
};
@group(0) @binding(0) var<storage, read_write> i : u32; layout(binding = 0, std430) buffer i_block_1 {
uint inner;
fn main() { } i;
for(i++; (i < 10u); ) { void tint_symbol() {
{
for(i.inner = (i.inner + 1u); (i.inner < 10u); ) {
}
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,13 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
@group(0) @binding(0) var<storage, read_write> i : u32;
fn main() {
for(i++; (i < 10u); ) {
}
} }
Failed to generate: error: cannot modify value of type 'u32' RWByteAddressBuffer i : register(u0, space0);
void main() {
{
[loop] for(i.Store(0u, asuint((i.Load(0u) + 1u))); (i.Load(0u) < 10u); ) {
}
}
}

View File

@ -1,11 +1,8 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
@group(0) @binding(0) var<storage, read_write> i : u32; void tint_symbol(device uint* const tint_symbol_1) {
for(*(tint_symbol_1) = (*(tint_symbol_1) + 1u); (*(tint_symbol_1) < 10u); ) {
fn tint_symbol() {
for(i++; (i < 10u); ) {
} }
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,60 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
@group(0) @binding(0) var<storage, read_write> i : u32; ; Bound: 30
; Schema: 0
fn main() { OpCapability Shader
for(i++; (i < 10u); ) { OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
} OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %i_block "i_block"
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpMemberName %i_block 0 "inner"
OpName %i "i"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %i_block Block
OpMemberDecorate %i_block 0 Offset 0
OpDecorate %i DescriptorSet 0
OpDecorate %i Binding 0
%uint = OpTypeInt 32 0
%i_block = OpTypeStruct %uint
%_ptr_StorageBuffer_i_block = OpTypePointer StorageBuffer %i_block
%i = OpVariable %_ptr_StorageBuffer_i_block StorageBuffer
%void = OpTypeVoid
%5 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%uint_10 = OpConstant %uint 10
%bool = OpTypeBool
%unused_entry_point = OpFunction %void None %5
%8 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %5
%10 = OpLabel
%13 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%14 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%15 = OpLoad %uint %14
%17 = OpIAdd %uint %15 %uint_1
OpStore %13 %17
OpBranch %18
%18 = OpLabel
OpLoopMerge %19 %20 None
OpBranch %21
%21 = OpLabel
%23 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%24 = OpLoad %uint %23
%26 = OpULessThan %bool %24 %uint_10
%22 = OpLogicalNot %bool %26
OpSelectionMerge %28 None
OpBranchConditional %22 %29 %28
%29 = OpLabel
OpBranch %19
%28 = OpLabel
OpBranch %20
%20 = OpLabel
OpBranch %18
%19 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -1,9 +1,11 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
fn main() { void unused_entry_point() {
var i = 0; return;
i++; }
void tint_symbol() {
int i = 0;
i = (i + 1);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,9 +1,9 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
fn main() {
var i = 0;
i++;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement void main() {
int i = 0;
i = (i + 1);
}

View File

@ -1,9 +1,8 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
fn tint_symbol() { void tint_symbol() {
var i = 0; int i = 0;
i++; i = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,9 +1,32 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
fn main() { ; Bound: 15
var i = 0; ; Schema: 0
i++; OpCapability Shader
} OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpName %i "i"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Function_int = OpTypePointer Function %int
%11 = OpConstantNull %int
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%6 = OpLabel
%i = OpVariable %_ptr_Function_int Function %11
OpStore %i %int_0
%12 = OpLoad %int %i
%14 = OpIAdd %int %12 %int_1
OpStore %i %14
OpReturn
OpFunctionEnd

View File

@ -1,10 +1,11 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
var<private> i : i32 = 0; void unused_entry_point() {
return;
fn main() { }
i++; int i = 0;
void tint_symbol() {
i = (i + 1);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,10 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
var<private> i : i32 = 0;
fn main() {
i++;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement static int i = 0;
void main() {
i = (i + 1);
}

View File

@ -1,10 +1,7 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
var<private> i : i32 = 0; void tint_symbol(thread int* const tint_symbol_1) {
*(tint_symbol_1) = as_type<int>((as_type<uint>(*(tint_symbol_1)) + as_type<uint>(1)));
fn tint_symbol() {
i++;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,30 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
var<private> i : i32 = 0; ; Bound: 14
; Schema: 0
fn main() { OpCapability Shader
i++; OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpName %i "i"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Private_int = OpTypePointer Private %int
%i = OpVariable %_ptr_Private_int Private %int_0
%void = OpTypeVoid
%5 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %5
%8 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %5
%10 = OpLabel
%11 = OpLoad %int %i
%13 = OpIAdd %int %11 %int_1
OpStore %i %13
OpReturn
OpFunctionEnd

View File

@ -1,10 +1,17 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct i_block {
uint inner;
};
@group(0) @binding(0) var<storage, read_write> i : u32; layout(binding = 0, std430) buffer i_block_1 {
uint inner;
fn main() { } i;
i++; void tint_symbol() {
i.inner = (i.inner + 1u);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,10 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
@group(0) @binding(0) var<storage, read_write> i : u32;
fn main() {
i++;
} }
Failed to generate: error: cannot modify value of type 'u32' RWByteAddressBuffer i : register(u0, space0);
void main() {
i.Store(0u, asuint((i.Load(0u) + 1u)));
}

View File

@ -1,10 +1,7 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
@group(0) @binding(0) var<storage, read_write> i : u32; void tint_symbol(device uint* const tint_symbol_1) {
*(tint_symbol_1) = (*(tint_symbol_1) + 1u);
fn tint_symbol() {
i++;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,40 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
@group(0) @binding(0) var<storage, read_write> i : u32; ; Bound: 18
; Schema: 0
fn main() { OpCapability Shader
i++; OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpName %i_block "i_block"
OpMemberName %i_block 0 "inner"
OpName %i "i"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %i_block Block
OpMemberDecorate %i_block 0 Offset 0
OpDecorate %i DescriptorSet 0
OpDecorate %i Binding 0
%uint = OpTypeInt 32 0
%i_block = OpTypeStruct %uint
%_ptr_StorageBuffer_i_block = OpTypePointer StorageBuffer %i_block
%i = OpVariable %_ptr_StorageBuffer_i_block StorageBuffer
%void = OpTypeVoid
%5 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%unused_entry_point = OpFunction %void None %5
%8 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %5
%10 = OpLabel
%13 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%14 = OpAccessChain %_ptr_StorageBuffer_uint %i %uint_0
%15 = OpLoad %uint %14
%17 = OpIAdd %uint %15 %uint_1
OpStore %13 %17
OpReturn
OpFunctionEnd

View File

@ -1,11 +1,19 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct a_block {
uvec4 inner;
};
@group(0) @binding(0) var<storage, read_write> a : vec4<u32>; layout(binding = 0, std430) buffer a_block_1 {
uvec4 inner;
fn main() { } a;
a[1]++; void tint_symbol() {
a.z++; int tint_symbol_2 = 1;
a.inner[tint_symbol_2] = (a.inner[tint_symbol_2] + 1u);
a.inner.z = (a.inner.z + 1u);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,12 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
@group(0) @binding(0) var<storage, read_write> a : vec4<u32>;
fn main() {
a[1]++;
a.z++;
} }
Failed to generate: error: cannot modify value of type 'u32' RWByteAddressBuffer a : register(u0, space0);
void main() {
const int tint_symbol_1 = 1;
a.Store((4u * uint(tint_symbol_1)), asuint((a.Load((4u * uint(tint_symbol_1))) + 1u)));
a.Store(8u, asuint((a.Load(8u) + 1u)));
}

View File

@ -1,11 +1,9 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
@group(0) @binding(0) var<storage, read_write> a : vec4<u32>; void tint_symbol(device uint4* const tint_symbol_3) {
int const tint_symbol_2 = 1;
fn tint_symbol() { (*(tint_symbol_3))[tint_symbol_2] = ((*(tint_symbol_3))[tint_symbol_2] + 1u);
a[1]++; (*(tint_symbol_3))[2] = ((*(tint_symbol_3))[2] + 1u);
a.z++;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,11 +1,49 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
@group(0) @binding(0) var<storage, read_write> a : vec4<u32>; ; Bound: 26
; Schema: 0
fn main() { OpCapability Shader
a[1]++; OpMemoryModel Logical GLSL450
a.z++; OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
} OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %a_block "a_block"
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpMemberName %a_block 0 "inner"
OpName %a "a"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
OpDecorate %a_block Block
OpMemberDecorate %a_block 0 Offset 0
OpDecorate %a DescriptorSet 0
OpDecorate %a Binding 0
%uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4
%a_block = OpTypeStruct %v4uint
%_ptr_StorageBuffer_a_block = OpTypePointer StorageBuffer %a_block
%a = OpVariable %_ptr_StorageBuffer_a_block StorageBuffer
%void = OpTypeVoid
%6 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%unused_entry_point = OpFunction %void None %6
%9 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %6
%11 = OpLabel
%16 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %int_1
%17 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %int_1
%18 = OpLoad %uint %17
%20 = OpIAdd %uint %18 %uint_1
OpStore %16 %20
%22 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %uint_2
%23 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 %uint_2
%24 = OpLoad %uint %23
%25 = OpIAdd %uint %24 %uint_1
OpStore %22 %25
OpReturn
OpFunctionEnd

View File

@ -1,10 +1,11 @@
SKIP: FAILED #version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
var<workgroup> i : i32; void unused_entry_point() {
return;
fn main() { }
i++; shared int i;
void tint_symbol() {
i = (i + 1);
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,10 @@
SKIP: FAILED [numthreads(1, 1, 1)]
void unused_entry_point() {
return;
var<workgroup> i : i32;
fn main() {
i++;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement groupshared int i;
void main() {
i = (i + 1);
}

View File

@ -1,10 +1,7 @@
SKIP: FAILED #include <metal_stdlib>
using namespace metal;
var<workgroup> i : i32; void tint_symbol(threadgroup int* const tint_symbol_1) {
*(tint_symbol_1) = as_type<int>((as_type<uint>(*(tint_symbol_1)) + as_type<uint>(1)));
fn tint_symbol() {
i++;
} }
Failed to generate: error: unknown statement type: tint::ast::IncrementDecrementStatement

View File

@ -1,10 +1,29 @@
SKIP: FAILED ; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
var<workgroup> i : i32; ; Bound: 13
; Schema: 0
fn main() { OpCapability Shader
i++; OpMemoryModel Logical GLSL450
} OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
Failed to generate: Unknown statement: tint::ast::IncrementDecrementStatement OpName %i "i"
OpName %unused_entry_point "unused_entry_point"
OpName %main "main"
%int = OpTypeInt 32 1
%_ptr_Workgroup_int = OpTypePointer Workgroup %int
%i = OpVariable %_ptr_Workgroup_int Workgroup
%void = OpTypeVoid
%4 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %4
%7 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %4
%9 = OpLabel
%10 = OpLoad %int %i
%12 = OpIAdd %int %10 %int_1
OpStore %i %12
OpReturn
OpFunctionEnd