tint/reader/spirv: Generate 'i' suffixed literals

For all i32 literal values.

Reduces risk of the SPIR-V reader producing WGSL that behaves
differently, when abstract-integers are fully implemented.

Bug: tint:1504
Change-Id: Ieaf8afec5b09c7978c75a38c6ed144633ddc017e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88843
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton 2022-05-04 22:25:19 +00:00 committed by Dawn LUCI CQ
parent 8822e2966a
commit 06496d4d1a
34 changed files with 593 additions and 586 deletions

View File

@ -2989,9 +2989,9 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) {
selectors.emplace_back(create<ast::IntLiteralExpression>(
Source{}, value32, ast::IntLiteralExpression::Suffix::kU));
} else {
selectors.emplace_back(create<ast::IntLiteralExpression>(
Source{}, static_cast<int32_t>(value32),
ast::IntLiteralExpression::Suffix::kNone));
selectors.emplace_back(
create<ast::IntLiteralExpression>(Source{}, static_cast<int32_t>(value32),
ast::IntLiteralExpression::Suffix::kI));
}
}
}

View File

@ -81,16 +81,16 @@ std::string AstFor(std::string assembly) {
return "vec2<u32>(20u, 10u)";
}
if (assembly == "v2int_30_40") {
return "vec2<i32>(30, 40)";
return "vec2<i32>(30i, 40i)";
}
if (assembly == "v2int_40_30") {
return "vec2<i32>(40, 30)";
return "vec2<i32>(40i, 30i)";
}
if (assembly == "cast_int_v2uint_10_20") {
return "bitcast<vec2<i32>>(vec2<u32>(10u, 20u))";
}
if (assembly == "cast_uint_v2int_40_30") {
return "bitcast<vec2<u32>>(vec2<i32>(40, 30))";
return "bitcast<vec2<u32>>(vec2<i32>(40i, 30i))";
}
if (assembly == "v2float_50_60") {
return "vec2<f32>(50.0, 60.0)";
@ -116,7 +116,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Int) {
auto fe = p->function_emitter(100);
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : i32 = -(30);"));
EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : i32 = -(30i);"));
}
TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) {
@ -150,7 +150,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("let x_1 : u32 = bitcast<u32>(-(30));"));
HasSubstr("let x_1 : u32 = bitcast<u32>(-(30i));"));
}
TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) {
@ -184,7 +184,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("let x_1 : vec2<i32> = -(vec2<i32>(30, 40));"));
HasSubstr("let x_1 : vec2<i32> = -(vec2<i32>(30i, 40i));"));
}
TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) {
@ -218,7 +218,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("let x_1 : vec2<u32> = bitcast<vec2<u32>>(-(vec2<i32>(30, 40)));"));
HasSubstr("let x_1 : vec2<u32> = bitcast<vec2<u32>>(-(vec2<i32>(30i, 40i)));"));
}
TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) {
@ -359,7 +359,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpIAdd", "uint_20", "u32", "10u", "+", "20u"}, // Both int
BinaryData{"int", "int_30", "OpIAdd", "int_40", "i32", "30", "+", "40"}, // Both v2uint
BinaryData{"int", "int_30", "OpIAdd", "int_40", "i32", "30i", "+", "40i"}, // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpIAdd", "v2uint_20_10", "vec2<u32>",
AstFor("v2uint_10_20"), "+", AstFor("v2uint_20_10")},
// Both v2int
@ -372,22 +372,23 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Mixed, uint <- int uint
BinaryDataGeneral{"uint", "int_30", "OpIAdd", "uint_10", "u32",
"bitcast<u32>((30 + bitcast<i32>(10u)))"},
"bitcast<u32>((30i + bitcast<i32>(10u)))"},
// Mixed, int <- int uint
BinaryDataGeneral{"int", "int_30", "OpIAdd", "uint_10", "i32", "(30 + bitcast<i32>(10u))"},
BinaryDataGeneral{"int", "int_30", "OpIAdd", "uint_10", "i32", "(30i + bitcast<i32>(10u))"},
// Mixed, uint <- uint int
BinaryDataGeneral{"uint", "uint_10", "OpIAdd", "int_30", "u32", "(10u + bitcast<u32>(30))"},
BinaryDataGeneral{"uint", "uint_10", "OpIAdd", "int_30", "u32",
"(10u + bitcast<u32>(30i))"},
// Mixed, int <- uint uint
BinaryDataGeneral{"int", "uint_20", "OpIAdd", "uint_10", "i32",
"bitcast<i32>((20u + 10u))"},
// Mixed, returning v2uint
BinaryDataGeneral{
"v2uint", "v2int_30_40", "OpIAdd", "v2uint_10_20", "vec2<u32>",
R"(bitcast<vec2<u32>>((vec2<i32>(30, 40) + bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
R"(bitcast<vec2<u32>>((vec2<i32>(30i, 40i) + bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
// Mixed, returning v2int
BinaryDataGeneral{
"v2int", "v2uint_10_20", "OpIAdd", "v2int_40_30", "vec2<i32>",
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) + bitcast<vec2<u32>>(vec2<i32>(40, 30)))))"}));
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) + bitcast<vec2<u32>>(vec2<i32>(40i, 30i)))))"}));
INSTANTIATE_TEST_SUITE_P(SpvParserTest_FAdd,
SpvBinaryArithTest,
@ -405,7 +406,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpISub", "uint_20", "u32", "10u", "-", "20u"}, // Both int
BinaryData{"int", "int_30", "OpISub", "int_40", "i32", "30", "-", "40"}, // Both v2uint
BinaryData{"int", "int_30", "OpISub", "int_40", "i32", "30i", "-", "40i"}, // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpISub", "v2uint_20_10", "vec2<u32>",
AstFor("v2uint_10_20"), "-", AstFor("v2uint_20_10")},
// Both v2int
@ -418,22 +419,23 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Mixed, uint <- int uint
BinaryDataGeneral{"uint", "int_30", "OpISub", "uint_10", "u32",
R"(bitcast<u32>((30 - bitcast<i32>(10u))))"},
R"(bitcast<u32>((30i - bitcast<i32>(10u))))"},
// Mixed, int <- int uint
BinaryDataGeneral{"int", "int_30", "OpISub", "uint_10", "i32", "(30 - bitcast<i32>(10u))"},
BinaryDataGeneral{"int", "int_30", "OpISub", "uint_10", "i32", "(30i - bitcast<i32>(10u))"},
// Mixed, uint <- uint int
BinaryDataGeneral{"uint", "uint_10", "OpISub", "int_30", "u32", "(10u - bitcast<u32>(30))"},
BinaryDataGeneral{"uint", "uint_10", "OpISub", "int_30", "u32",
"(10u - bitcast<u32>(30i))"},
// Mixed, int <- uint uint
BinaryDataGeneral{"int", "uint_20", "OpISub", "uint_10", "i32",
"bitcast<i32>((20u - 10u))"},
// Mixed, returning v2uint
BinaryDataGeneral{
"v2uint", "v2int_30_40", "OpISub", "v2uint_10_20", "vec2<u32>",
R"(bitcast<vec2<u32>>((vec2<i32>(30, 40) - bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
R"(bitcast<vec2<u32>>((vec2<i32>(30i, 40i) - bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
// Mixed, returning v2int
BinaryDataGeneral{
"v2int", "v2uint_10_20", "OpISub", "v2int_40_30", "vec2<i32>",
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) - bitcast<vec2<u32>>(vec2<i32>(40, 30)))))"}));
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) - bitcast<vec2<u32>>(vec2<i32>(40i, 30i)))))"}));
INSTANTIATE_TEST_SUITE_P(SpvParserTest_FSub,
SpvBinaryArithTest,
@ -451,7 +453,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpIMul", "uint_20", "u32", "10u", "*", "20u"}, // Both int
BinaryData{"int", "int_30", "OpIMul", "int_40", "i32", "30", "*", "40"}, // Both v2uint
BinaryData{"int", "int_30", "OpIMul", "int_40", "i32", "30i", "*", "40i"}, // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpIMul", "v2uint_20_10", "vec2<u32>",
AstFor("v2uint_10_20"), "*", AstFor("v2uint_20_10")},
// Both v2int
@ -464,22 +466,23 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Mixed, uint <- int uint
BinaryDataGeneral{"uint", "int_30", "OpIMul", "uint_10", "u32",
"bitcast<u32>((30 * bitcast<i32>(10u)))"},
"bitcast<u32>((30i * bitcast<i32>(10u)))"},
// Mixed, int <- int uint
BinaryDataGeneral{"int", "int_30", "OpIMul", "uint_10", "i32", "(30 * bitcast<i32>(10u))"},
BinaryDataGeneral{"int", "int_30", "OpIMul", "uint_10", "i32", "(30i * bitcast<i32>(10u))"},
// Mixed, uint <- uint int
BinaryDataGeneral{"uint", "uint_10", "OpIMul", "int_30", "u32", "(10u * bitcast<u32>(30))"},
BinaryDataGeneral{"uint", "uint_10", "OpIMul", "int_30", "u32",
"(10u * bitcast<u32>(30i))"},
// Mixed, int <- uint uint
BinaryDataGeneral{"int", "uint_20", "OpIMul", "uint_10", "i32",
"bitcast<i32>((20u * 10u))"},
// Mixed, returning v2uint
BinaryDataGeneral{
"v2uint", "v2int_30_40", "OpIMul", "v2uint_10_20", "vec2<u32>",
R"(bitcast<vec2<u32>>((vec2<i32>(30, 40) * bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
R"(bitcast<vec2<u32>>((vec2<i32>(30i, 40i) * bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
// Mixed, returning v2int
BinaryDataGeneral{
"v2int", "v2uint_10_20", "OpIMul", "v2int_40_30", "vec2<i32>",
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) * bitcast<vec2<u32>>(vec2<i32>(40, 30)))))"}));
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) * bitcast<vec2<u32>>(vec2<i32>(40i, 30i)))))"}));
INSTANTIATE_TEST_SUITE_P(SpvParserTest_FMul,
SpvBinaryArithTest,
@ -506,7 +509,7 @@ INSTANTIATE_TEST_SUITE_P(
SpvBinaryArithTest,
::testing::Values(
// Both int
BinaryData{"int", "int_30", "OpSDiv", "int_40", "i32", "30", "/", "40"}, // Both v2int
BinaryData{"int", "int_30", "OpSDiv", "int_40", "i32", "30i", "/", "40i"}, // Both v2int
BinaryData{"v2int", "v2int_30_40", "OpSDiv", "v2int_40_30", "vec2<i32>",
AstFor("v2int_30_40"), "/", AstFor("v2int_40_30")}));
@ -515,10 +518,10 @@ INSTANTIATE_TEST_SUITE_P(
SpvBinaryArithTest,
::testing::Values(
// Mixed, returning int, second arg uint
BinaryData{"int", "int_30", "OpSDiv", "uint_10", "i32", "30", "/", "bitcast<i32>(10u)"},
BinaryData{"int", "int_30", "OpSDiv", "uint_10", "i32", "30i", "/", "bitcast<i32>(10u)"},
// Mixed, returning int, first arg uint
BinaryData{"int", "uint_10", "OpSDiv", "int_30", "i32", "bitcast<i32>(10u)", "/",
"30"}, // Mixed, returning v2int, first arg v2uint
"30i"}, // Mixed, returning v2int, first arg v2uint
BinaryData{"v2int", "v2uint_10_20", "OpSDiv", "v2int_30_40", "vec2<i32>",
AstFor("cast_int_v2uint_10_20"), "/", AstFor("v2int_30_40")},
// Mixed, returning v2int, second arg v2uint
@ -543,7 +546,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Scalar_UnsignedResult) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("let x_1 : u32 = bitcast<u32>((30 / 40));"));
HasSubstr("let x_1 : u32 = bitcast<u32>((30i / 40i));"));
}
TEST_F(SpvBinaryArithTestBasic, SDiv_Vector_UnsignedResult) {
@ -566,7 +569,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Vector_UnsignedResult) {
EXPECT_THAT(
test::ToString(p->program(), ast_body),
HasSubstr(
R"(let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) / vec2<i32>(40, 30)));)"));
R"(let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30i, 40i) / vec2<i32>(40i, 30i)));)"));
}
INSTANTIATE_TEST_SUITE_P(SpvParserTest_FDiv,
@ -597,7 +600,7 @@ INSTANTIATE_TEST_SUITE_P(
SpvBinaryArithTest,
::testing::Values(
// Both int
BinaryData{"int", "int_30", "OpSMod", "int_40", "i32", "30", "%", "40"}, // Both v2int
BinaryData{"int", "int_30", "OpSMod", "int_40", "i32", "30i", "%", "40i"}, // Both v2int
BinaryData{"v2int", "v2int_30_40", "OpSMod", "v2int_40_30", "vec2<i32>",
AstFor("v2int_30_40"), "%", AstFor("v2int_40_30")}));
@ -606,10 +609,10 @@ INSTANTIATE_TEST_SUITE_P(
SpvBinaryArithTest,
::testing::Values(
// Mixed, returning int, second arg uint
BinaryData{"int", "int_30", "OpSMod", "uint_10", "i32", "30", "%", "bitcast<i32>(10u)"},
BinaryData{"int", "int_30", "OpSMod", "uint_10", "i32", "30i", "%", "bitcast<i32>(10u)"},
// Mixed, returning int, first arg uint
BinaryData{"int", "uint_10", "OpSMod", "int_30", "i32", "bitcast<i32>(10u)", "%",
"30"}, // Mixed, returning v2int, first arg v2uint
"30i"}, // Mixed, returning v2int, first arg v2uint
BinaryData{"v2int", "v2uint_10_20", "OpSMod", "v2int_30_40", "vec2<i32>",
AstFor("cast_int_v2uint_10_20"), "%", AstFor("v2int_30_40")},
// Mixed, returning v2int, second arg v2uint
@ -634,7 +637,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Scalar_UnsignedResult) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("let x_1 : u32 = bitcast<u32>((30 % 40));"));
HasSubstr("let x_1 : u32 = bitcast<u32>((30i % 40i));"));
}
TEST_F(SpvBinaryArithTestBasic, SMod_Vector_UnsignedResult) {
@ -657,7 +660,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Vector_UnsignedResult) {
EXPECT_THAT(
test::ToString(p->program(), ast_body),
HasSubstr(
R"(let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) % vec2<i32>(40, 30)));)"));
R"(let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30i, 40i) % vec2<i32>(40i, 30i)));)"));
}
INSTANTIATE_TEST_SUITE_P(SpvParserTest_FRem,

View File

@ -72,10 +72,10 @@ std::string AstFor(std::string assembly) {
return "vec2<u32>(20u, 10u)";
}
if (assembly == "v2int_30_40") {
return "vec2<i32>(30, 40)";
return "vec2<i32>(30i, 40i)";
}
if (assembly == "v2int_40_30") {
return "vec2<i32>(40, 30)";
return "vec2<i32>(40i, 30i)";
}
if (assembly == "cast_int_v2uint_10_20") {
return "bitcast<vec2<i32>(vec2<u32>(10u, 20u))";
@ -177,7 +177,7 @@ INSTANTIATE_TEST_SUITE_P(
// uint uint -> uint
BinaryData{"uint", "uint_10", "OpShiftLeftLogical", "uint_20", "u32", "10u", "<<", "20u"},
// int, uint -> int
BinaryData{"int", "int_30", "OpShiftLeftLogical", "uint_20", "i32", "30", "<<", "20u"},
BinaryData{"int", "int_30", "OpShiftLeftLogical", "uint_20", "i32", "30i", "<<", "20u"},
// v2uint v2uint -> v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpShiftLeftLogical", "v2uint_20_10", "vec2<u32>",
AstFor("v2uint_10_20"), "<<", AstFor("v2uint_20_10")},
@ -192,16 +192,16 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// int, int -> int
BinaryDataGeneral{"int", "int_30", "OpShiftLeftLogical", "int_40", "i32",
"(30 << bitcast<u32>(40))"},
"(30i << bitcast<u32>(40i))"},
// uint, int -> uint
BinaryDataGeneral{"uint", "uint_10", "OpShiftLeftLogical", "int_40", "u32",
"(10u << bitcast<u32>(40))"},
"(10u << bitcast<u32>(40i))"},
// v2uint, v2int -> v2uint
BinaryDataGeneral{"v2uint", "v2uint_10_20", "OpShiftLeftLogical", "v2uint_20_10",
"vec2<u32>", "(vec2<u32>(10u, 20u) << vec2<u32>(20u, 10u))"},
// v2int, v2int -> v2int
BinaryDataGeneral{"v2int", "v2int_30_40", "OpShiftLeftLogical", "v2int_40_30", "vec2<i32>",
"(vec2<i32>(30, 40) << bitcast<vec2<u32>>(vec2<i32>(40, 30)))"}));
"(vec2<i32>(30i, 40i) << bitcast<vec2<u32>>(vec2<i32>(40i, 30i)))"}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_ShiftLeftLogical_BitcastResult,
@ -209,11 +209,11 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// int, int -> uint
BinaryDataGeneral{"uint", "int_30", "OpShiftLeftLogical", "uint_10", "u32",
"bitcast<u32>((30 << 10u))"},
"bitcast<u32>((30i << 10u))"},
// v2uint, v2int -> v2uint
BinaryDataGeneral{"v2uint", "v2int_30_40", "OpShiftLeftLogical", "v2uint_20_10",
"vec2<u32>",
"bitcast<vec2<u32>>((vec2<i32>(30, 40) << vec2<u32>(20u, 10u)))"}));
"bitcast<vec2<u32>>((vec2<i32>(30i, 40i) << vec2<u32>(20u, 10u)))"}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_ShiftRightLogical_Arg2Unsigned,
@ -224,14 +224,14 @@ INSTANTIATE_TEST_SUITE_P(
"(10u >> 20u)"},
// int, uint -> int
BinaryDataGeneral{"int", "int_30", "OpShiftRightLogical", "uint_20", "i32",
"bitcast<i32>((bitcast<u32>(30) >> 20u))"},
"bitcast<i32>((bitcast<u32>(30i) >> 20u))"},
// v2uint, v2uint -> v2uint
BinaryDataGeneral{"v2uint", "v2uint_10_20", "OpShiftRightLogical", "v2uint_20_10",
"vec2<u32>", "(vec2<u32>(10u, 20u) >> vec2<u32>(20u, 10u))"},
// v2int, v2uint -> v2int
BinaryDataGeneral{
"v2int", "v2int_30_40", "OpShiftRightLogical", "v2uint_10_20", "vec2<i32>",
R"(bitcast<vec2<i32>>((bitcast<vec2<u32>>(vec2<i32>(30, 40)) >> vec2<u32>(10u, 20u))))"}));
R"(bitcast<vec2<i32>>((bitcast<vec2<u32>>(vec2<i32>(30i, 40i)) >> vec2<u32>(10u, 20u))))"}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_ShiftRightLogical_Arg2Signed,
@ -239,18 +239,18 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// uint, int -> uint
BinaryDataGeneral{"uint", "uint_10", "OpShiftRightLogical", "int_30", "u32",
"(10u >> bitcast<u32>(30))"},
"(10u >> bitcast<u32>(30i))"},
// int, int -> int
BinaryDataGeneral{"int", "int_30", "OpShiftRightLogical", "int_40", "i32",
"bitcast<i32>((bitcast<u32>(30) >> bitcast<u32>(40)))"},
"bitcast<i32>((bitcast<u32>(30i) >> bitcast<u32>(40i)))"},
// v2uint, v2int -> v2uint
BinaryDataGeneral{"v2uint", "v2uint_10_20", "OpShiftRightLogical", "v2int_30_40",
"vec2<u32>",
"(vec2<u32>(10u, 20u) >> bitcast<vec2<u32>>(vec2<i32>(30, 40)))"},
"(vec2<u32>(10u, 20u) >> bitcast<vec2<u32>>(vec2<i32>(30i, 40i)))"},
// v2int, v2int -> v2int
BinaryDataGeneral{
"v2int", "v2int_40_30", "OpShiftRightLogical", "v2int_30_40", "vec2<i32>",
R"(bitcast<vec2<i32>>((bitcast<vec2<u32>>(vec2<i32>(40, 30)) >> bitcast<vec2<u32>>(vec2<i32>(30, 40)))))"}));
R"(bitcast<vec2<i32>>((bitcast<vec2<u32>>(vec2<i32>(40i, 30i)) >> bitcast<vec2<u32>>(vec2<i32>(30i, 40i)))))"}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_ShiftRightLogical_BitcastResult,
@ -273,14 +273,14 @@ INSTANTIATE_TEST_SUITE_P(
"bitcast<u32>((bitcast<i32>(10u) >> 20u))"},
// int, uint -> int
BinaryDataGeneral{"int", "int_30", "OpShiftRightArithmetic", "uint_10", "i32",
"(30 >> 10u)"},
"(30i >> 10u)"},
// v2uint, v2uint -> v2uint
BinaryDataGeneral{
"v2uint", "v2uint_10_20", "OpShiftRightArithmetic", "v2uint_20_10", "vec2<u32>",
R"(bitcast<vec2<u32>>((bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) >> vec2<u32>(20u, 10u))))"},
// v2int, v2uint -> v2int
BinaryDataGeneral{"v2int", "v2int_40_30", "OpShiftRightArithmetic", "v2uint_20_10",
"vec2<i32>", "(vec2<i32>(40, 30) >> vec2<u32>(20u, 10u))"}));
"vec2<i32>", "(vec2<i32>(40i, 30i) >> vec2<u32>(20u, 10u))"}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_ShiftRightArithmetic_Arg2Signed,
@ -288,18 +288,18 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// uint, int -> uint
BinaryDataGeneral{"uint", "uint_10", "OpShiftRightArithmetic", "int_30", "u32",
"bitcast<u32>((bitcast<i32>(10u) >> bitcast<u32>(30)))"},
"bitcast<u32>((bitcast<i32>(10u) >> bitcast<u32>(30i)))"},
// int, int -> int
BinaryDataGeneral{"int", "int_30", "OpShiftRightArithmetic", "int_40", "i32",
"(30 >> bitcast<u32>(40))"},
"(30i >> bitcast<u32>(40i))"},
// v2uint, v2int -> v2uint
BinaryDataGeneral{
"v2uint", "v2uint_10_20", "OpShiftRightArithmetic", "v2int_30_40", "vec2<u32>",
R"(bitcast<vec2<u32>>((bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) >> bitcast<vec2<u32>>(vec2<i32>(30, 40)))))"},
R"(bitcast<vec2<u32>>((bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) >> bitcast<vec2<u32>>(vec2<i32>(30i, 40i)))))"},
// v2int, v2int -> v2int
BinaryDataGeneral{"v2int", "v2int_40_30", "OpShiftRightArithmetic", "v2int_30_40",
"vec2<i32>",
"(vec2<i32>(40, 30) >> bitcast<vec2<u32>>(vec2<i32>(30, 40)))"}));
"(vec2<i32>(40i, 30i) >> bitcast<vec2<u32>>(vec2<i32>(30i, 40i)))"}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_ShiftRightArithmetic_BitcastResult,
@ -307,11 +307,11 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// int, uint -> uint
BinaryDataGeneral{"uint", "int_30", "OpShiftRightArithmetic", "uint_10", "u32",
"bitcast<u32>((30 >> 10u))"},
"bitcast<u32>((30i >> 10u))"},
// v2int, v2uint -> v2uint
BinaryDataGeneral{"v2uint", "v2int_30_40", "OpShiftRightArithmetic", "v2uint_20_10",
"vec2<u32>",
"bitcast<vec2<u32>>((vec2<i32>(30, 40) >> vec2<u32>(20u, 10u)))"}));
"bitcast<vec2<u32>>((vec2<i32>(30i, 40i) >> vec2<u32>(20u, 10u)))"}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_BitwiseAnd,
@ -320,7 +320,7 @@ INSTANTIATE_TEST_SUITE_P(
// Both uint
BinaryData{"uint", "uint_10", "OpBitwiseAnd", "uint_20", "u32", "10u", "&", "20u"},
// Both int
BinaryData{"int", "int_30", "OpBitwiseAnd", "int_40", "i32", "30", "&", "40"},
BinaryData{"int", "int_30", "OpBitwiseAnd", "int_40", "i32", "30i", "&", "40i"},
// TODO(crbug.com/tint/678): Resolver fails on vector bitwise operations
// Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpBitwiseAnd", "v2uint_20_10", "vec2<u32>",
@ -335,24 +335,24 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Mixed, uint <- int uint
BinaryDataGeneral{"uint", "int_30", "OpBitwiseAnd", "uint_10", "u32",
"bitcast<u32>((30 & bitcast<i32>(10u)))"},
"bitcast<u32>((30i & bitcast<i32>(10u)))"},
// Mixed, int <- int uint
BinaryDataGeneral{"int", "int_30", "OpBitwiseAnd", "uint_10", "i32",
"(30 & bitcast<i32>(10u))"},
"(30i & bitcast<i32>(10u))"},
// Mixed, uint <- uint int
BinaryDataGeneral{"uint", "uint_10", "OpBitwiseAnd", "int_30", "u32",
"(10u & bitcast<u32>(30))"},
"(10u & bitcast<u32>(30i))"},
// Mixed, int <- uint uint
BinaryDataGeneral{"int", "uint_20", "OpBitwiseAnd", "uint_10", "i32",
"bitcast<i32>((20u & 10u))"},
// Mixed, returning v2uint
BinaryDataGeneral{
"v2uint", "v2int_30_40", "OpBitwiseAnd", "v2uint_10_20", "vec2<u32>",
R"(bitcast<vec2<u32>>((vec2<i32>(30, 40) & bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
R"(bitcast<vec2<u32>>((vec2<i32>(30i, 40i) & bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
// Mixed, returning v2int
BinaryDataGeneral{
"v2int", "v2uint_10_20", "OpBitwiseAnd", "v2int_40_30", "vec2<i32>",
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) & bitcast<vec2<u32>>(vec2<i32>(40, 30)))))"}));
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) & bitcast<vec2<u32>>(vec2<i32>(40i, 30i)))))"}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_BitwiseOr,
@ -361,7 +361,7 @@ INSTANTIATE_TEST_SUITE_P(
// Both uint
BinaryData{"uint", "uint_10", "OpBitwiseOr", "uint_20", "u32", "10u", "|", "20u"},
// Both int
BinaryData{"int", "int_30", "OpBitwiseOr", "int_40", "i32", "30", "|", "40"},
BinaryData{"int", "int_30", "OpBitwiseOr", "int_40", "i32", "30i", "|", "40i"},
// TODO(crbug.com/tint/678): Resolver fails on vector bitwise operations
// Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpBitwiseOr", "v2uint_20_10", "vec2<u32>",
@ -376,24 +376,24 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Mixed, uint <- int uint
BinaryDataGeneral{"uint", "int_30", "OpBitwiseOr", "uint_10", "u32",
"bitcast<u32>((30 | bitcast<i32>(10u)))"},
"bitcast<u32>((30i | bitcast<i32>(10u)))"},
// Mixed, int <- int uint
BinaryDataGeneral{"int", "int_30", "OpBitwiseOr", "uint_10", "i32",
"(30 | bitcast<i32>(10u))"},
"(30i | bitcast<i32>(10u))"},
// Mixed, uint <- uint int
BinaryDataGeneral{"uint", "uint_10", "OpBitwiseOr", "int_30", "u32",
"(10u | bitcast<u32>(30))"},
"(10u | bitcast<u32>(30i))"},
// Mixed, int <- uint uint
BinaryDataGeneral{"int", "uint_20", "OpBitwiseOr", "uint_10", "i32",
"bitcast<i32>((20u | 10u))"},
// Mixed, returning v2uint
BinaryDataGeneral{
"v2uint", "v2int_30_40", "OpBitwiseOr", "v2uint_10_20", "vec2<u32>",
R"(bitcast<vec2<u32>>((vec2<i32>(30, 40) | bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
R"(bitcast<vec2<u32>>((vec2<i32>(30i, 40i) | bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
// Mixed, returning v2int
BinaryDataGeneral{
"v2int", "v2uint_10_20", "OpBitwiseOr", "v2int_40_30", "vec2<i32>",
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) | bitcast<vec2<u32>>(vec2<i32>(40, 30)))))"}));
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) | bitcast<vec2<u32>>(vec2<i32>(40i, 30i)))))"}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_BitwiseXor,
@ -402,7 +402,7 @@ INSTANTIATE_TEST_SUITE_P(
// Both uint
BinaryData{"uint", "uint_10", "OpBitwiseXor", "uint_20", "u32", "10u", "^", "20u"},
// Both int
BinaryData{"int", "int_30", "OpBitwiseXor", "int_40", "i32", "30", "^", "40"},
BinaryData{"int", "int_30", "OpBitwiseXor", "int_40", "i32", "30i", "^", "40i"},
// TODO(crbug.com/tint/678): Resolver fails on vector bitwise operations
// Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpBitwiseXor", "v2uint_20_10", "vec2<u32>",
@ -417,24 +417,24 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Mixed, uint <- int uint
BinaryDataGeneral{"uint", "int_30", "OpBitwiseXor", "uint_10", "u32",
"bitcast<u32>((30 ^ bitcast<i32>(10u)))"},
"bitcast<u32>((30i ^ bitcast<i32>(10u)))"},
// Mixed, int <- int uint
BinaryDataGeneral{"int", "int_30", "OpBitwiseXor", "uint_10", "i32",
"(30 ^ bitcast<i32>(10u))"},
"(30i ^ bitcast<i32>(10u))"},
// Mixed, uint <- uint int
BinaryDataGeneral{"uint", "uint_10", "OpBitwiseXor", "int_30", "u32",
"(10u ^ bitcast<u32>(30))"},
"(10u ^ bitcast<u32>(30i))"},
// Mixed, int <- uint uint
BinaryDataGeneral{"int", "uint_20", "OpBitwiseXor", "uint_10", "i32",
"bitcast<i32>((20u ^ 10u))"},
// Mixed, returning v2uint
BinaryDataGeneral{
"v2uint", "v2int_30_40", "OpBitwiseXor", "v2uint_10_20", "vec2<u32>",
R"(bitcast<vec2<u32>>((vec2<i32>(30, 40) ^ bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
R"(bitcast<vec2<u32>>((vec2<i32>(30i, 40i) ^ bitcast<vec2<i32>>(vec2<u32>(10u, 20u)))))"},
// Mixed, returning v2int
BinaryDataGeneral{
"v2int", "v2uint_10_20", "OpBitwiseXor", "v2int_40_30", "vec2<i32>",
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) ^ bitcast<vec2<u32>>(vec2<i32>(40, 30)))))"}));
R"(bitcast<vec2<i32>>((vec2<u32>(10u, 20u) ^ bitcast<vec2<u32>>(vec2<i32>(40i, 30i)))))"}));
TEST_F(SpvUnaryBitTest, Not_Int_Int) {
const auto assembly = SimplePreamble() + R"(
@ -450,7 +450,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Int) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
auto body = test::ToString(p->program(), ast_body);
EXPECT_THAT(body, HasSubstr("let x_1 : i32 = ~(30);"));
EXPECT_THAT(body, HasSubstr("let x_1 : i32 = ~(30i);"));
}
TEST_F(SpvUnaryBitTest, Not_Int_Uint) {
@ -484,7 +484,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Int) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
auto body = test::ToString(p->program(), ast_body);
EXPECT_THAT(body, HasSubstr("let x_1 : u32 = bitcast<u32>(~(30));"));
EXPECT_THAT(body, HasSubstr("let x_1 : u32 = bitcast<u32>(~(30i));"));
}
TEST_F(SpvUnaryBitTest, Not_Uint_Uint) {
@ -518,7 +518,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
auto body = test::ToString(p->program(), ast_body);
EXPECT_THAT(body, HasSubstr("let x_1 : vec2<i32> = ~(vec2<i32>(30, 40));"));
EXPECT_THAT(body, HasSubstr("let x_1 : vec2<i32> = ~(vec2<i32>(30i, 40i));"));
}
TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) {
@ -553,7 +553,8 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
auto body = test::ToString(p->program(), ast_body);
EXPECT_THAT(body, HasSubstr("let x_1 : vec2<u32> = bitcast<vec2<u32>>(~(vec2<i32>(30, 40)));"));
EXPECT_THAT(body,
HasSubstr("let x_1 : vec2<u32> = bitcast<vec2<u32>>(~(vec2<i32>(30i, 40i)));"));
}
TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) {
const auto assembly = SimplePreamble() + R"(
@ -840,7 +841,7 @@ TEST_F(SpvUnaryBitTest, InsertBits_Int) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
auto body = test::ToString(p->program(), ast_body);
EXPECT_THAT(body, HasSubstr("let x_1 : vec2<i32> = insertBits(30, 40, 10u, 20u);")) << body;
EXPECT_THAT(body, HasSubstr("let x_1 : vec2<i32> = insertBits(30i, 40i, 10u, 20u);")) << body;
}
TEST_F(SpvUnaryBitTest, InsertBits_IntVector) {
@ -858,7 +859,7 @@ TEST_F(SpvUnaryBitTest, InsertBits_IntVector) {
EXPECT_THAT(
body,
HasSubstr(
R"(let x_1 : vec2<i32> = insertBits(vec2<i32>(30, 40), vec2<i32>(40, 30), 10u, 20u);)"))
R"(let x_1 : vec2<i32> = insertBits(vec2<i32>(30i, 40i), vec2<i32>(40i, 30i), 10u, 20u);)"))
<< body;
}
@ -908,7 +909,7 @@ TEST_F(SpvUnaryBitTest, ExtractBits_Int) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
auto body = test::ToString(p->program(), ast_body);
EXPECT_THAT(body, HasSubstr("let x_1 : vec2<i32> = extractBits(30, 10u, 20u);")) << body;
EXPECT_THAT(body, HasSubstr("let x_1 : vec2<i32> = extractBits(30i, 10u, 20u);")) << body;
}
TEST_F(SpvUnaryBitTest, ExtractBits_IntVector) {
@ -923,7 +924,8 @@ TEST_F(SpvUnaryBitTest, ExtractBits_IntVector) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
auto body = test::ToString(p->program(), ast_body);
EXPECT_THAT(body, HasSubstr("let x_1 : vec2<i32> = extractBits(vec2<i32>(30, 40), 10u, 20u);"))
EXPECT_THAT(body,
HasSubstr("let x_1 : vec2<i32> = extractBits(vec2<i32>(30i, 40i), 10u, 20u);"))
<< body;
}

View File

@ -9392,14 +9392,14 @@ TEST_F(SpvParserCFGTest, EmitBody_Switch_Case_SintValue) {
auto ast_body = fe.ast_body();
auto got = test::ToString(p->program(), ast_body);
auto* expect = R"(var_1 = 1u;
switch(42) {
case -294967296: {
switch(42i) {
case -294967296i: {
var_1 = 40u;
}
case 2000000000: {
case 2000000000i: {
var_1 = 30u;
}
case 20: {
case 20i: {
var_1 = 20u;
}
default: {

View File

@ -97,7 +97,7 @@ TEST_F(SpvParserTest_Composite_Construct, Vector) {
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr(R"(let x_1 : vec2<u32> = vec2<u32>(10u, 20u);
let x_2 : vec2<i32> = vec2<i32>(30, 40);
let x_2 : vec2<i32> = vec2<i32>(30i, 40i);
let x_3 : vec2<f32> = vec2<f32>(50.0, 60.0);
)"));
}
@ -153,7 +153,7 @@ TEST_F(SpvParserTest_Composite_Construct, Struct) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("let x_1 : S = S(vec2<f32>(50.0, 60.0), 5u, 30);"));
HasSubstr("let x_1 : S = S(vec2<f32>(50.0, 60.0), 5u, 30i);"));
}
TEST_F(SpvParserTest_Composite_Construct, ConstantComposite_Struct_NoDeduplication) {
@ -608,7 +608,7 @@ TEST_F(SpvParserTest_CompositeInsert, Struct) {
EXPECT_THAT(body_str, HasSubstr(R"(var x_36 : S;
let x_1 : S = x_36;
var x_2_1 : S = x_1;
x_2_1.field2 = 30;
x_2_1.field2 = 30i;
let x_2 : S = x_2_1;
)")) << body_str;
}

View File

@ -94,22 +94,22 @@ std::string AstFor(std::string assembly) {
return "bitcast<vec2<i32>>(vec2<u32>(20u, 10u))";
}
if (assembly == "cast_int_30") {
return "bitcast<u32>(30)";
return "bitcast<u32>(30i)";
}
if (assembly == "cast_int_40") {
return "bitcast<u32>(40)";
return "bitcast<u32>(40i)";
}
if (assembly == "v2int_30_40") {
return "vec2<i32>(30, 40)";
return "vec2<i32>(30i, 40i)";
}
if (assembly == "cast_v2int_30_40") {
return "bitcast<vec2<u32>>(vec2<i32>(30, 40))";
return "bitcast<vec2<u32>>(vec2<i32>(30i, 40i))";
}
if (assembly == "v2int_40_30") {
return "vec2<i32>(40, 30)";
return "vec2<i32>(40i, 30i)";
}
if (assembly == "cast_v2int_40_30") {
return "bitcast<vec2<u32>>(vec2<i32>(40, 30))";
return "bitcast<vec2<u32>>(vec2<i32>(40i, 30i))";
}
if (assembly == "v2float_50_60") {
return "vec2<f32>(50.0, 60.0)";
@ -202,12 +202,12 @@ INSTANTIATE_TEST_SUITE_P(
// uint uint
BinaryData{"bool", "uint_10", "OpIEqual", "uint_20", "bool", "10u", "==", "20u"},
// int int
BinaryData{"bool", "int_30", "OpIEqual", "int_40", "bool", "30", "==", "40"},
BinaryData{"bool", "int_30", "OpIEqual", "int_40", "bool", "30i", "==", "40i"},
// uint int
BinaryData{"bool", "uint_10", "OpIEqual", "int_40", "bool", "10u",
"==", "bitcast<u32>(40)"},
"==", "bitcast<u32>(40i)"},
// int uint
BinaryData{"bool", "int_40", "OpIEqual", "uint_10", "bool", "40",
BinaryData{"bool", "int_40", "OpIEqual", "uint_10", "bool", "40i",
"==", "bitcast<i32>(10u)"},
// v2uint v2uint
BinaryData{"v2bool", "v2uint_10_20", "OpIEqual", "v2uint_20_10", "vec2<bool>",
@ -232,12 +232,12 @@ INSTANTIATE_TEST_SUITE_P(
// Both uint
BinaryData{"bool", "uint_10", "OpINotEqual", "uint_20", "bool", "10u", "!=", "20u"},
// Both int
BinaryData{"bool", "int_30", "OpINotEqual", "int_40", "bool", "30", "!=", "40"},
BinaryData{"bool", "int_30", "OpINotEqual", "int_40", "bool", "30i", "!=", "40i"},
// uint int
BinaryData{"bool", "uint_10", "OpINotEqual", "int_40", "bool", "10u",
"!=", "bitcast<u32>(40)"},
"!=", "bitcast<u32>(40i)"},
// int uint
BinaryData{"bool", "int_40", "OpINotEqual", "uint_10", "bool", "40",
BinaryData{"bool", "int_40", "OpINotEqual", "uint_10", "bool", "40i",
"!=", "bitcast<i32>(10u)"},
// Both v2uint
BinaryData{"v2bool", "v2uint_10_20", "OpINotEqual", "v2uint_20_10", "vec2<bool>",
@ -416,12 +416,12 @@ INSTANTIATE_TEST_SUITE_P(
SpvBinaryLogicalTest,
::testing::Values(
// Both signed
BinaryData{"bool", "int_30", "OpSGreaterThan", "int_40", "bool", "30", ">", "40"},
BinaryData{"bool", "int_30", "OpSGreaterThan", "int_40", "bool", "30i", ">", "40i"},
// First arg unsigned
BinaryData{"bool", "uint_10", "OpSGreaterThan", "int_40", "bool", AstFor("cast_uint_10"),
">", "40"},
">", "40i"},
// Second arg unsigned
BinaryData{"bool", "int_30", "OpSGreaterThan", "uint_20", "bool", "30", ">",
BinaryData{"bool", "int_30", "OpSGreaterThan", "uint_20", "bool", "30i", ">",
AstFor("cast_uint_20")},
// Vector, both signed
BinaryData{"v2bool", "v2int_30_40", "OpSGreaterThan", "v2int_40_30", "vec2<bool>",
@ -438,12 +438,12 @@ INSTANTIATE_TEST_SUITE_P(
SpvBinaryLogicalTest,
::testing::Values(
// Both signed
BinaryData{"bool", "int_30", "OpSGreaterThanEqual", "int_40", "bool", "30", ">=", "40"},
BinaryData{"bool", "int_30", "OpSGreaterThanEqual", "int_40", "bool", "30i", ">=", "40i"},
// First arg unsigned
BinaryData{"bool", "uint_10", "OpSGreaterThanEqual", "int_40", "bool",
AstFor("cast_uint_10"), ">=", "40"},
AstFor("cast_uint_10"), ">=", "40i"},
// Second arg unsigned
BinaryData{"bool", "int_30", "OpSGreaterThanEqual", "uint_20", "bool", "30",
BinaryData{"bool", "int_30", "OpSGreaterThanEqual", "uint_20", "bool", "30i",
">=", AstFor("cast_uint_20")},
// Vector, both signed
BinaryData{"v2bool", "v2int_30_40", "OpSGreaterThanEqual", "v2int_40_30", "vec2<bool>",
@ -460,12 +460,12 @@ INSTANTIATE_TEST_SUITE_P(
SpvBinaryLogicalTest,
::testing::Values(
// Both signed
BinaryData{"bool", "int_30", "OpSLessThan", "int_40", "bool", "30", "<", "40"},
BinaryData{"bool", "int_30", "OpSLessThan", "int_40", "bool", "30i", "<", "40i"},
// First arg unsigned
BinaryData{"bool", "uint_10", "OpSLessThan", "int_40", "bool", AstFor("cast_uint_10"), "<",
"40"},
"40i"},
// Second arg unsigned
BinaryData{"bool", "int_30", "OpSLessThan", "uint_20", "bool", "30", "<",
BinaryData{"bool", "int_30", "OpSLessThan", "uint_20", "bool", "30i", "<",
AstFor("cast_uint_20")},
// Vector, both signed
BinaryData{"v2bool", "v2int_30_40", "OpSLessThan", "v2int_40_30", "vec2<bool>",
@ -482,12 +482,12 @@ INSTANTIATE_TEST_SUITE_P(
SpvBinaryLogicalTest,
::testing::Values(
// Both signed
BinaryData{"bool", "int_30", "OpSLessThanEqual", "int_40", "bool", "30", "<=", "40"},
BinaryData{"bool", "int_30", "OpSLessThanEqual", "int_40", "bool", "30i", "<=", "40i"},
// First arg unsigned
BinaryData{"bool", "uint_10", "OpSLessThanEqual", "int_40", "bool", AstFor("cast_uint_10"),
"<=", "40"},
"<=", "40i"},
// Second arg unsigned
BinaryData{"bool", "int_30", "OpSLessThanEqual", "uint_20", "bool", "30",
BinaryData{"bool", "int_30", "OpSLessThanEqual", "uint_20", "bool", "30i",
"<=", AstFor("cast_uint_20")},
// Vector, both signed
BinaryData{"v2bool", "v2int_30_40", "OpSLessThanEqual", "v2int_40_30", "vec2<bool>",

View File

@ -107,8 +107,9 @@ TEST_F(SpvParserMemoryTest, EmitStatement_StoreIntConst) {
auto fe = p->function_emitter(100);
EXPECT_TRUE(fe.EmitBody());
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(x_1 = 42;
x_1 = 0;
EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(x_1 = 42i;
x_1 = 0i;
return;
)"));
}

View File

@ -74,7 +74,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_BeforeFunction_Scalar) {
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(let x_11 : bool = false;
let x_12 : u32 = 0u;
let x_13 : i32 = 0;
let x_13 : i32 = 0i;
let x_14 : f32 = 0.0;
)"));
}
@ -132,7 +132,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Scalar) {
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(let x_11 : bool = false;
let x_12 : u32 = 0u;
let x_13 : i32 = 0;
let x_13 : i32 = 0i;
let x_14 : f32 = 0.0;
)"));
}
@ -224,7 +224,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) {
EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("let x_11 : S = S(false, 0u, 0, 0.0);"));
HasSubstr("let x_11 : S = S(false, 0u, 0i, 0.0);"));
}
TEST_F(SpvParserTestMiscInstruction, OpNop) {

View File

@ -182,7 +182,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_ScalarInitializers) {
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(var a : bool = true;
var b : bool = false;
var c : i32 = -1;
var c : i32 = -1i;
var d : u32 = 1u;
var e : f32 = 1.5;
)"));
@ -210,7 +210,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_ScalarNullInitializers) {
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(var a : bool = false;
var b : i32 = 0;
var b : i32 = 0i;
var c : u32 = 0u;
var d : f32 = 0.0;
)"));
@ -1506,7 +1506,7 @@ TEST_F(SpvParserFunctionVarTest, EmitStatement_Hoist_CompositeInsert) {
const auto* expected = R"(var x_200 : vec2<i32>;
if (true) {
x_200 = vec2<i32>();
x_200.x = 0;
x_200.x = 0i;
} else {
return;
}
@ -1549,7 +1549,7 @@ TEST_F(SpvParserFunctionVarTest, EmitStatement_Hoist_VectorInsertDynamic) {
const auto* expected = R"(var x_200 : vec2<i32>;
if (true) {
x_200 = vec2<i32>();
x_200[1] = 3;
x_200[1i] = 3i;
} else {
return;
}
@ -1597,7 +1597,7 @@ TEST_F(SpvParserFunctionVarTest, EmitStatement_Hoist_UsedAsNonPtrArg) {
const auto got = test::ToString(p->program(), ast_body);
const auto* expected = R"(var x_200 : i32;
if (true) {
x_200 = 1;
x_200 = 1i;
} else {
return;
}

View File

@ -1332,7 +1332,7 @@ bool ParserImpl::EmitScalarSpecConstants() {
[&](const I32*) {
return create<ast::IntLiteralExpression>(
Source{}, static_cast<int64_t>(literal_value),
ast::IntLiteralExpression::Suffix::kNone);
ast::IntLiteralExpression::Suffix::kI);
},
[&](const U32*) {
return create<ast::IntLiteralExpression>(
@ -1907,7 +1907,7 @@ TypedExpression ParserImpl::MakeConstantExpressionForScalarSpirvConstant(
[&](const I32*) {
return TypedExpression{ty_.I32(), create<ast::IntLiteralExpression>(
source, spirv_const->GetS32(),
ast::IntLiteralExpression::Suffix::kNone)};
ast::IntLiteralExpression::Suffix::kI)};
},
[&](const U32*) {
return TypedExpression{ty_.U32(), create<ast::IntLiteralExpression>(
@ -1947,7 +1947,7 @@ const ast::Expression* ParserImpl::MakeNullValue(const Type* type) {
type, //
[&](const I32*) {
return create<ast::IntLiteralExpression>(Source{}, 0,
ast::IntLiteralExpression::Suffix::kNone);
ast::IntLiteralExpression::Suffix::kI);
},
[&](const U32*) {
return create<ast::IntLiteralExpression>(Source{}, 0,

View File

@ -1499,7 +1499,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
"textureGather(1, x_20, x_10, coords12)"},
"textureGather(1i, x_20, x_10, coords12)"},
// OpImageGather 2D ConstOffset signed
ImageAccessCase{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageGather "
@ -1507,7 +1507,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
"textureGather(1, x_20, x_10, coords12, vec2<i32>(3, 4))"},
"textureGather(1i, x_20, x_10, coords12, vec2<i32>(3i, 4i))"},
// OpImageGather 2D ConstOffset unsigned
ImageAccessCase{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageGather "
@ -1516,7 +1516,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
"textureGather(1, x_20, x_10, coords12, "
"textureGather(1i, x_20, x_10, coords12, "
"vec2<i32>(vec2<u32>(3u, 4u)))"},
// OpImageGather 2D Array
ImageAccessCase{"%float 2D 0 1 0 1 Unknown",
@ -1525,7 +1525,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
"textureGather(1, x_20, x_10, coords123.xy, "
"textureGather(1i, x_20, x_10, coords123.xy, "
"i32(round(coords123.z)))"},
// OpImageGather 2D Array ConstOffset signed
ImageAccessCase{"%float 2D 0 1 0 1 Unknown",
@ -1534,8 +1534,8 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
"textureGather(1, x_20, x_10, coords123.xy, "
"i32(round(coords123.z)), vec2<i32>(3, 4))"},
"textureGather(1i, x_20, x_10, coords123.xy, "
"i32(round(coords123.z)), vec2<i32>(3i, 4i))"},
// OpImageGather 2D Array ConstOffset unsigned
ImageAccessCase{"%float 2D 0 1 0 1 Unknown",
"%result = OpImageGather "
@ -1544,7 +1544,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
"textureGather(1, x_20, x_10, coords123.xy, "
"textureGather(1i, x_20, x_10, coords123.xy, "
"i32(round(coords123.z)), "
"vec2<i32>(vec2<u32>(3u, 4u)))"},
// OpImageGather Cube
@ -1554,7 +1554,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_cube<f32>;)",
"textureGather(1, x_20, x_10, coords123)"},
"textureGather(1i, x_20, x_10, coords123)"},
// OpImageGather Cube Array
ImageAccessCase{"%float Cube 0 1 0 1 Unknown",
"%result = OpImageGather "
@ -1562,7 +1562,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_cube_array<f32>;)",
"textureGather(1, x_20, x_10, coords1234.xyz, "
"textureGather(1i, x_20, x_10, coords1234.xyz, "
"i32(round(coords1234.w)))"},
// OpImageGather 2DDepth
ImageAccessCase{"%float 2D 1 0 0 1 Unknown",
@ -1579,7 +1579,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_depth_2d;)",
"textureGather(x_20, x_10, coords12, vec2<i32>(3, 4))"},
"textureGather(x_20, x_10, coords12, vec2<i32>(3i, 4i))"},
// OpImageGather 2DDepth ConstOffset unsigned
ImageAccessCase{"%float 2D 1 0 0 1 Unknown",
"%result = OpImageGather "
@ -1607,7 +1607,7 @@ INSTANTIATE_TEST_SUITE_P(
@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
"textureGather(x_20, x_10, coords123.xy, "
"i32(round(coords123.z)), vec2<i32>(3, 4))"},
"i32(round(coords123.z)), vec2<i32>(3i, 4i))"},
// OpImageGather 2DDepth Array ConstOffset unsigned
ImageAccessCase{"%float 2D 1 1 0 1 Unknown",
"%result = OpImageGather "
@ -1657,7 +1657,7 @@ INSTANTIATE_TEST_SUITE_P(
@group(2) @binding(1) var x_20 : texture_depth_2d;)",
"textureGatherCompare(x_20, x_10, coords12, 0.200000003, "
"vec2<i32>(3, 4))"},
"vec2<i32>(3i, 4i))"},
// OpImageDrefGather 2DDepth ConstOffset unsigned
ImageAccessCase{"%float 2D 1 0 0 1 Unknown",
"%result = OpImageDrefGather "
@ -1685,7 +1685,7 @@ INSTANTIATE_TEST_SUITE_P(
@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
"textureGatherCompare(x_20, x_10, coords123.xy, "
"i32(round(coords123.z)), 0.200000003, vec2<i32>(3, 4))"},
"i32(round(coords123.z)), 0.200000003, vec2<i32>(3i, 4i))"},
// OpImageDrefGather 2DDepth Array ConstOffset unsigned
ImageAccessCase{"%float 2D 1 1 0 1 Unknown",
"%result = OpImageDrefGather "
@ -1745,7 +1745,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
"textureSample(x_20, x_10, coords12, vec2<i32>(3, 4))"},
"textureSample(x_20, x_10, coords12, vec2<i32>(3i, 4i))"},
// OpImageSampleImplicitLod arrayed with ConstOffset
ImageAccessCase{
@ -1755,7 +1755,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSample(x_20, x_10, coords123.xy, i32(round(coords123.z)), vec2<i32>(3, 4)))"},
R"(textureSample(x_20, x_10, coords123.xy, i32(round(coords123.z)), vec2<i32>(3i, 4i)))"},
// OpImageSampleImplicitLod with Bias
ImageAccessCase{"%float 2D 0 0 0 1 Unknown",
@ -1784,7 +1784,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleBias(x_20, x_10, coords12, 7.0, vec2<i32>(3, 4))"},
R"(textureSampleBias(x_20, x_10, coords12, 7.0, vec2<i32>(3i, 4i))"},
// OpImageSampleImplicitLod with Bias and unsigned ConstOffset
// Convert ConstOffset to signed
@ -1806,7 +1806,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSampleBias(x_20, x_10, coords123.xy, i32(round(coords123.z)), 7.0, vec2<i32>(3, 4))"}));
R"(textureSampleBias(x_20, x_10, coords123.xy, i32(round(coords123.z)), 7.0, vec2<i32>(3i, 4i))"}));
INSTANTIATE_TEST_SUITE_P(
// This test shows the use of a sampled image used with both regular
@ -1866,7 +1866,7 @@ INSTANTIATE_TEST_SUITE_P(
@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompare(x_20, x_10, coords12, 0.200000003, vec2<i32>(3, 4)))"},
R"(textureSampleCompare(x_20, x_10, coords12, 0.200000003, vec2<i32>(3i, 4i)))"},
// ImageSampleDrefImplicitLod arrayed with ConstOffset
ImageAccessCase{
"%float 2D 0 1 0 1 Unknown",
@ -1875,7 +1875,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler_comparison;
@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
R"(textureSampleCompare(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003, vec2<i32>(3, 4)))"}));
R"(textureSampleCompare(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003, vec2<i32>(3i, 4i)))"}));
INSTANTIATE_TEST_SUITE_P(
ImageSampleDrefExplicitLod,
@ -1911,7 +1911,7 @@ INSTANTIATE_TEST_SUITE_P(
@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003, vec2<i32>(3, 4)))"},
R"(textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003, vec2<i32>(3i, 4i)))"},
// 2D array, ConstOffset
ImageAccessCase{
"%float 2D 1 1 0 1 Unknown",
@ -1921,7 +1921,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler_comparison;
@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
R"(textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003, vec2<i32>(3, 4)))"},
R"(textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003, vec2<i32>(3i, 4i)))"},
// Cube
ImageAccessCase{"%float Cube 1 0 0 1 Unknown",
"%result = OpImageSampleDrefExplicitLod "
@ -1972,7 +1972,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleLevel(x_20, x_10, coords12, 0.0, vec2<i32>(3, 4)))"},
R"(textureSampleLevel(x_20, x_10, coords12, 0.0, vec2<i32>(3i, 4i)))"},
// OpImageSampleExplicitLod - using Lod and unsigned ConstOffset
// Convert the ConstOffset operand to signed
@ -1995,7 +1995,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSampleLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.0, vec2<i32>(3, 4)))"}));
R"(textureSampleLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.0, vec2<i32>(3i, 4i)))"}));
INSTANTIATE_TEST_SUITE_P(
ImageSampleExplicitLod_UsingGrad,
@ -2022,14 +2022,15 @@ INSTANTIATE_TEST_SUITE_P(
R"(textureSampleGrad(x_20, x_10, coords123.xy, i32(round(coords123.z)), vf12, vf21))"},
// OpImageSampleExplicitLod - using Grad and ConstOffset
ImageAccessCase{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords12 Grad|ConstOffset "
"%vf12 %vf21 %offsets2d",
R"(@group(0) @binding(0) var x_10 : sampler;
ImageAccessCase{
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords12 Grad|ConstOffset "
"%vf12 %vf21 %offsets2d",
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleGrad(x_20, x_10, coords12, vf12, vf21, vec2<i32>(3, 4)))"},
R"(textureSampleGrad(x_20, x_10, coords12, vf12, vf21, vec2<i32>(3i, 4i)))"},
// OpImageSampleExplicitLod - using Grad and unsigned ConstOffset
ImageAccessCase{
@ -2051,7 +2052,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSampleGrad(x_20, x_10, coords123.xy, i32(round(coords123.z)), vf12, vf21, vec2<i32>(3, 4)))"},
R"(textureSampleGrad(x_20, x_10, coords123.xy, i32(round(coords123.z)), vf12, vf21, vec2<i32>(3i, 4i)))"},
// OpImageSampleExplicitLod arrayed - using Grad and unsigned
// ConstOffset
@ -2160,7 +2161,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSample(x_20, x_10, (coords123.xy / coords123.z), vec2<i32>(3, 4)))"}));
R"(textureSample(x_20, x_10, (coords123.xy / coords123.z), vec2<i32>(3i, 4i)))"}));
INSTANTIATE_TEST_SUITE_P(
ImageSampleProjImplicitLod_Bias,
@ -2186,7 +2187,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0, vec2<i32>(3, 4)))"},
R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0, vec2<i32>(3i, 4i)))"},
// OpImageSampleProjImplicitLod with Bias and unsigned ConstOffset
// Convert ConstOffset to signed
@ -2221,7 +2222,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleLevel(x_20, x_10, (coords123.xy / coords123.z), f1, vec2<i32>(3, 4)))"}));
R"(textureSampleLevel(x_20, x_10, (coords123.xy / coords123.z), f1, vec2<i32>(3i, 4i)))"}));
INSTANTIATE_TEST_SUITE_P(
ImageSampleProjExplicitLod_Grad,
@ -2246,7 +2247,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(@group(0) @binding(0) var x_10 : sampler;
@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleGrad(x_20, x_10, (coords123.xy / coords123.z), vf12, vf21, vec2<i32>(3, 4)))"}));
R"(textureSampleGrad(x_20, x_10, (coords123.xy / coords123.z), vf12, vf21, vec2<i32>(3i, 4i)))"}));
INSTANTIATE_TEST_SUITE_P(
// Ordinary (non-comparison) sampling on a depth texture.
@ -2291,7 +2292,7 @@ INSTANTIATE_TEST_SUITE_P(
@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompare(x_20, x_10, (coords123.xy / coords123.z), f1, vec2<i32>(3, 4)))"}));
R"(textureSampleCompare(x_20, x_10, (coords123.xy / coords123.z), f1, vec2<i32>(3i, 4i)))"}));
INSTANTIATE_TEST_SUITE_P(
DISABLED_ImageSampleProjDrefExplicitLod_Lod,
@ -2322,7 +2323,7 @@ INSTANTIATE_TEST_SUITE_P(
@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompareLevel(x_20, x_10, (coords123.xy / coords123.z), 0.200000003, 0.0, vec2<i32>(3, 4)))"}));
R"(textureSampleCompareLevel(x_20, x_10, (coords123.xy / coords123.z), 0.200000003, 0.0, vec2<i32>(3i, 4i)))"}));
/////
// End projection sampling
@ -2563,7 +2564,7 @@ INSTANTIATE_TEST_SUITE_P(
// Source signed, dest signed
{"%int 2D 0 0 0 2 R32i", "OpImageWrite %im %vi12 %vi12",
R"(@group(2) @binding(1) var x_20 : texture_storage_2d<r32sint, write>;)",
R"(textureStore(x_20, vi12, vec4<i32>(vi12, 0, 0)))"}}));
R"(textureStore(x_20, vi12, vec4<i32>(vi12, 0i, 0i)))"}}));
INSTANTIATE_TEST_SUITE_P(
ImageFetch_OptionalParams,
@ -2573,20 +2574,20 @@ INSTANTIATE_TEST_SUITE_P(
// Level of detail is injected for sampled texture
{"%float 2D 0 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12",
R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0);)"},
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0i);)"},
// OpImageFetch with explicit level, on sampled texture
{"%float 2D 0 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12 Lod %int_3",
R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 3);)"},
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 3i);)"},
// OpImageFetch with no extra params, on depth texture
// Level of detail is injected for depth texture
{"%float 2D 1 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12",
R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)",
R"(let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 0), 0.0, 0.0, 0.0);)"},
R"(let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 0i), 0.0, 0.0, 0.0);)"},
// OpImageFetch with extra params, on depth texture
{"%float 2D 1 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12 Lod %int_3",
R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)",
R"(let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 3), 0.0, 0.0, 0.0);)"}}));
R"(let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 3i), 0.0, 0.0, 0.0);)"}}));
INSTANTIATE_TEST_SUITE_P(
ImageFetch_Depth,
@ -2599,7 +2600,7 @@ INSTANTIATE_TEST_SUITE_P(
// ImageFetch on depth image.
{"%float 2D 1 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12 ",
R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)",
R"(let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 0), 0.0, 0.0, 0.0);)"}}));
R"(let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 0i), 0.0, 0.0, 0.0);)"}}));
INSTANTIATE_TEST_SUITE_P(
ImageFetch_DepthMultisampled,
@ -2657,11 +2658,11 @@ INSTANTIATE_TEST_SUITE_P(ConvertResultSignedness,
// OpImageFetch requires no conversion, float -> v4float
{"%float 2D 0 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12",
R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0);)"},
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0i);)"},
// OpImageFetch requires no conversion, uint -> v4uint
{"%uint 2D 0 0 0 1 Unknown", "%99 = OpImageFetch %v4uint %im %vi12",
R"(@group(2) @binding(1) var x_20 : texture_2d<u32>;)",
R"(let x_99 : vec4<u32> = textureLoad(x_20, vi12, 0);)"},
R"(let x_99 : vec4<u32> = textureLoad(x_20, vi12, 0i);)"},
// OpImageFetch requires conversion, uint -> v4int
// is invalid SPIR-V:
// "Expected Image 'Sampled Type' to be the same as Result Type
@ -2670,7 +2671,7 @@ INSTANTIATE_TEST_SUITE_P(ConvertResultSignedness,
// OpImageFetch requires no conversion, int -> v4int
{"%int 2D 0 0 0 1 Unknown", "%99 = OpImageFetch %v4int %im %vi12",
R"(@group(2) @binding(1) var x_20 : texture_2d<i32>;)",
R"(let x_99 : vec4<i32> = textureLoad(x_20, vi12, 0);)"},
R"(let x_99 : vec4<i32> = textureLoad(x_20, vi12, 0i);)"},
// OpImageFetch requires conversion, int -> v4uint
// is invalid SPIR-V:
// "Expected Image 'Sampled Type' to be the same as Result Type
@ -2683,11 +2684,11 @@ INSTANTIATE_TEST_SUITE_P(ConvertResultSignedness,
// OpImageRead requires no conversion, float -> v4float
{"%float 2D 0 0 0 2 Rgba32f", "%99 = OpImageRead %v4float %im %vi12",
R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0);)"},
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0i);)"},
// OpImageRead requires no conversion, uint -> v4uint
{"%uint 2D 0 0 0 2 Rgba32ui", "%99 = OpImageRead %v4uint %im %vi12",
R"(@group(2) @binding(1) var x_20 : texture_2d<u32>;)",
R"(let x_99 : vec4<u32> = textureLoad(x_20, vi12, 0);)"},
R"(let x_99 : vec4<u32> = textureLoad(x_20, vi12, 0i);)"},
// OpImageRead requires conversion, uint -> v4int
// is invalid SPIR-V:
@ -2697,7 +2698,7 @@ INSTANTIATE_TEST_SUITE_P(ConvertResultSignedness,
// OpImageRead requires no conversion, int -> v4int
{"%int 2D 0 0 0 2 Rgba32i", "%99 = OpImageRead %v4int %im %vi12",
R"(@group(2) @binding(1) var x_20 : texture_2d<i32>;)",
R"(let x_99 : vec4<i32> = textureLoad(x_20, vi12, 0);)"},
R"(let x_99 : vec4<i32> = textureLoad(x_20, vi12, 0i);)"},
// OpImageRead requires conversion, int -> v4uint
// is invalid SPIR-V:

View File

@ -885,7 +885,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarInitializers) {
var<private> x_2 : bool = false;
var<private> x_3 : i32 = -1;
var<private> x_3 : i32 = -1i;
var<private> x_4 : u32 = 1u;
@ -910,7 +910,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarNullInitializers) {
const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, HasSubstr(R"(var<private> x_1 : bool = false;
var<private> x_2 : i32 = 0;
var<private> x_2 : i32 = 0i;
var<private> x_3 : u32 = 0u;
@ -935,7 +935,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarUndefInitializers) {
const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, HasSubstr(R"(var<private> x_1 : bool = false;
var<private> x_2 : i32 = 0;
var<private> x_2 : i32 = 0i;
var<private> x_3 : u32 = 0u;
@ -1550,7 +1550,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_I32) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, HasSubstr("@id(12) override myconst : i32 = 42;")) << module_str;
EXPECT_THAT(module_str, HasSubstr("@id(12) override myconst : i32 = 42i;")) << module_str;
}
TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_F32) {
@ -1985,7 +1985,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_In_U32_Direct) {
const std::string expected = R"(var<private> x_1 : array<u32, 1u>;
fn main_1() {
let x_3 : u32 = x_1[0];
let x_3 : u32 = x_1[0i];
return;
}
@ -2017,7 +2017,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_In_U32_CopyObject) {
const std::string expected = R"(var<private> x_1 : array<u32, 1u>;
fn main_1() {
let x_4 : u32 = x_1[0];
let x_4 : u32 = x_1[0i];
return;
}
@ -2049,7 +2049,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_In_U32_AccessChain) {
const std::string expected = R"(var<private> x_1 : array<u32, 1u>;
fn main_1() {
let x_4 : u32 = x_1[0];
let x_4 : u32 = x_1[0i];
return;
}
@ -2080,7 +2080,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_In_I32_Direct) {
const std::string expected = R"(var<private> x_1 : array<i32, 1u>;
fn main_1() {
let x_3 : i32 = x_1[0];
let x_3 : i32 = x_1[0i];
return;
}
@ -2112,7 +2112,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_In_I32_CopyObject) {
const std::string expected = R"(var<private> x_1 : array<i32, 1u>;
fn main_1() {
let x_4 : i32 = x_1[0];
let x_4 : i32 = x_1[0i];
return;
}
@ -2144,7 +2144,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_In_I32_AccessChain) {
const std::string expected = R"(var<private> x_1 : array<i32, 1u>;
fn main_1() {
let x_4 : i32 = x_1[0];
let x_4 : i32 = x_1[0i];
return;
}
@ -2193,7 +2193,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_Out_U32_Direct) {
const std::string expected = R"(var<private> x_1 : array<u32, 1u>;
fn main_1() {
x_1[0] = 0u;
x_1[0i] = 0u;
return;
}
@ -2230,7 +2230,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_Out_U32_CopyObject) {
const std::string expected = R"(var<private> x_1 : array<u32, 1u>;
fn main_1() {
x_1[0] = 0u;
x_1[0i] = 0u;
return;
}
@ -2267,7 +2267,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_Out_U32_AccessChain) {
const std::string expected = R"(var<private> x_1 : array<u32, 1u>;
fn main_1() {
x_1[0] = 0u;
x_1[0i] = 0u;
return;
}
@ -2303,7 +2303,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_Out_I32_Direct) {
const std::string expected = R"(var<private> x_1 : array<i32, 1u>;
fn main_1() {
x_1[0] = 12;
x_1[0i] = 12i;
return;
}
@ -2340,7 +2340,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_Out_I32_CopyObject) {
const std::string expected = R"(var<private> x_1 : array<i32, 1u>;
fn main_1() {
x_1[0] = 12;
x_1[0i] = 12i;
return;
}
@ -2377,7 +2377,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_Out_I32_AccessChain) {
const std::string expected = R"(var<private> x_1 : array<i32, 1u>;
fn main_1() {
x_1[0] = 12;
x_1[0i] = 12i;
return;
}
@ -2421,7 +2421,7 @@ type Arr_3 = @stride(4) array<i32, 2u>;
var<private> x_1 : Arr;
fn main_1() {
let x_3 : u32 = x_1[0];
let x_3 : u32 = x_1[0i];
return;
}
@ -2460,7 +2460,7 @@ type Arr_3 = @stride(4) array<i32, 2u>;
var<private> x_1 : Arr;
fn main_1() {
x_1[0] = 0u;
x_1[0i] = 0u;
return;
}
@ -3467,7 +3467,7 @@ TEST_F(SpvModuleScopeVarParserTest, Builtin_Output_Initializer_OppositeSignednes
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
EXPECT_TRUE(p->error().empty());
const auto got = test::ToString(p->program());
const std::string expected = "var<private> x_1 : array<i32, 1u> = array<i32, 1u>(14);";
const std::string expected = "var<private> x_1 : array<i32, 1u> = array<i32, 1u>(14i);";
EXPECT_THAT(got, HasSubstr(expected)) << got;
}

View File

@ -1,6 +1,6 @@
fn main_1() {
var m : mat3x3<f32> = mat3x3<f32>();
let x_15 : vec3<f32> = m[1];
let x_15 : vec3<f32> = m[1i];
let x_16 : f32 = x_15.y;
return;
}

View File

@ -22,11 +22,11 @@ struct S {
fn f_1() {
let x_19 : Arr_2 = s.a;
let x_24 : Arr_1 = s.a[3].el;
let x_28 : Arr = s.a[3].el[2];
let x_32 : f32 = s.a[3].el[2][1].el;
let x_24 : Arr_1 = s.a[3i].el;
let x_28 : Arr = s.a[3i].el[2i];
let x_32 : f32 = s.a[3i].el[2i][1i].el;
s.a = array<strided_arr_1, 4u>();
s.a[3].el[2][1].el = 5.0;
s.a[3i].el[2i][1i].el = 5.0;
return;
}

View File

@ -36,7 +36,7 @@ fn main_1() {
let x_21 : vec4<f32> = q;
p = vec3<f32>(x_21.x, x_21.y, x_21.z);
let x_27 : f32 = p.x;
let x_41 : f32 = x_14.test[0].el;
let x_41 : f32 = x_14.test[0i].el;
let x_45 : f32 = position.y;
let x_49 : f32 = x_14.time;
p.x = (x_27 + sin(((x_41 * x_45) + x_49)));

View File

@ -33,20 +33,20 @@ fn test_int_S1_c0_b() -> bool {
ok = true;
x_41_phi = false;
if (true) {
x_40 = all(((vec4<i32>(0, 0, 0, 0) / vec4<i32>(x_27, x_27, x_27, x_27)) == vec4<i32>(0, 0, 0, 0)));
x_40 = all(((vec4<i32>(0i, 0i, 0i, 0i) / vec4<i32>(x_27, x_27, x_27, x_27)) == vec4<i32>(0i, 0i, 0i, 0i)));
x_41_phi = x_40;
}
let x_41 : bool = x_41_phi;
ok = x_41;
let x_44 : vec4<i32> = vec4<i32>(x_27, x_27, x_27, x_27);
val = x_44;
let x_47 : vec4<i32> = (x_44 + vec4<i32>(1, 1, 1, 1));
let x_47 : vec4<i32> = (x_44 + vec4<i32>(1i, 1i, 1i, 1i));
val = x_47;
let x_48 : vec4<i32> = (x_47 - vec4<i32>(1, 1, 1, 1));
let x_48 : vec4<i32> = (x_47 - vec4<i32>(1i, 1i, 1i, 1i));
val = x_48;
let x_49 : vec4<i32> = (x_48 + vec4<i32>(1, 1, 1, 1));
let x_49 : vec4<i32> = (x_48 + vec4<i32>(1i, 1i, 1i, 1i));
val = x_49;
let x_50 : vec4<i32> = (x_49 - vec4<i32>(1, 1, 1, 1));
let x_50 : vec4<i32> = (x_49 - vec4<i32>(1i, 1i, 1i, 1i));
val = x_50;
x_55_phi = false;
if (x_41) {
@ -55,13 +55,13 @@ fn test_int_S1_c0_b() -> bool {
}
let x_55 : bool = x_55_phi;
ok = x_55;
let x_58 : vec4<i32> = (x_50 * vec4<i32>(2, 2, 2, 2));
let x_58 : vec4<i32> = (x_50 * vec4<i32>(2i, 2i, 2i, 2i));
val = x_58;
let x_59 : vec4<i32> = (x_58 / vec4<i32>(2, 2, 2, 2));
let x_59 : vec4<i32> = (x_58 / vec4<i32>(2i, 2i, 2i, 2i));
val = x_59;
let x_60 : vec4<i32> = (x_59 * vec4<i32>(2, 2, 2, 2));
let x_60 : vec4<i32> = (x_59 * vec4<i32>(2i, 2i, 2i, 2i));
val = x_60;
let x_61 : vec4<i32> = (x_60 / vec4<i32>(2, 2, 2, 2));
let x_61 : vec4<i32> = (x_60 / vec4<i32>(2i, 2i, 2i, 2i));
val = x_61;
x_66_phi = false;
if (x_55) {

View File

@ -4,12 +4,12 @@
fn main_1() {
var srcValue : vec4<u32>;
let x_18 : vec4<u32> = textureLoad(Src, vec2<i32>(0, 0), 0);
let x_18 : vec4<u32> = textureLoad(Src, vec2<i32>(0i, 0i), 0i);
srcValue = x_18;
let x_22 : u32 = srcValue.x;
srcValue.x = (x_22 + bitcast<u32>(1));
srcValue.x = (x_22 + bitcast<u32>(1i));
let x_27 : vec4<u32> = srcValue;
textureStore(Dst, vec2<i32>(0, 0), x_27);
textureStore(Dst, vec2<i32>(0i, 0i), x_27);
return;
}

File diff suppressed because it is too large Load Diff

View File

@ -16,12 +16,12 @@ struct x_B4_BuildInformation {
fn main_1() {
var orientation : array<i32, 6u>;
let x_23 : Arr = sspp962805860buildInformation.passthru.orientation;
orientation[0] = x_23[0u];
orientation[1] = x_23[1u];
orientation[2] = x_23[2u];
orientation[3] = x_23[3u];
orientation[4] = x_23[4u];
orientation[5] = x_23[5u];
orientation[0i] = x_23[0u];
orientation[1i] = x_23[1u];
orientation[2i] = x_23[2u];
orientation[3i] = x_23[3u];
orientation[4i] = x_23[4u];
orientation[5i] = x_23[5u];
return;
}

View File

@ -60,7 +60,7 @@ fn coordsInBounds_vi2_vi2_(coord : ptr<function, vec2<i32>>, shape : ptr<functio
var x_87 : bool;
var x_88_phi : bool;
let x_76 : vec2<i32> = *(coord);
let x_81 : bool = all((x_76 >= vec2<i32>(0, 0)));
let x_81 : bool = all((x_76 >= vec2<i32>(0i, 0i)));
x_88_phi = x_81;
if (x_81) {
let x_84 : vec2<i32> = *(coord);
@ -136,7 +136,7 @@ fn getOutputFlatIndex_vi3_(coords : ptr<function, vec3<i32>>) -> i32 {
let x_99 : vec3<i32> = *(coords);
let x_105 : i32 = x_48.outShapeStrides.x;
let x_107 : i32 = x_48.outShapeStrides.y;
return i32(dot(vec3<f32>(x_99), vec3<f32>(vec3<i32>(x_105, x_107, 1))));
return i32(dot(vec3<f32>(x_99), vec3<f32>(vec3<i32>(x_105, x_107, 1i))));
}
fn setOutput_i1_f1_(flatIndex : ptr<function, i32>, value : ptr<function, f32>) {
@ -223,26 +223,26 @@ fn mm_matMul_i1_i1_i1_(dimAOuter : ptr<function, i32>, dimInner : ptr<function,
var param_8 : i32;
var param_9 : f32;
let x_132 : u32 = gl_LocalInvocationID.y;
tileRow = (bitcast<i32>(x_132) * 1);
tileRow = (bitcast<i32>(x_132) * 1i);
let x_137 : u32 = gl_LocalInvocationID.x;
tileCol = (bitcast<i32>(x_137) * 1);
tileCol = (bitcast<i32>(x_137) * 1i);
let x_143 : u32 = gl_GlobalInvocationID.y;
globalRow = (bitcast<i32>(x_143) * 1);
globalRow = (bitcast<i32>(x_143) * 1i);
let x_148 : u32 = gl_GlobalInvocationID.x;
globalCol = (bitcast<i32>(x_148) * 1);
globalCol = (bitcast<i32>(x_148) * 1i);
let x_152 : i32 = *(dimInner);
numTiles = (((x_152 - 1) / 64) + 1);
innerRow = 0;
numTiles = (((x_152 - 1i) / 64i) + 1i);
innerRow = 0i;
loop {
let x_163 : i32 = innerRow;
if ((x_163 < 1)) {
if ((x_163 < 1i)) {
} else {
break;
}
innerCol = 0;
innerCol = 0i;
loop {
let x_171 : i32 = innerCol;
if ((x_171 < 1)) {
if ((x_171 < 1i)) {
} else {
break;
}
@ -252,20 +252,20 @@ fn mm_matMul_i1_i1_i1_(dimAOuter : ptr<function, i32>, dimInner : ptr<function,
continuing {
let x_181 : i32 = innerCol;
innerCol = (x_181 + 1);
innerCol = (x_181 + 1i);
}
}
continuing {
let x_183 : i32 = innerRow;
innerRow = (x_183 + 1);
innerRow = (x_183 + 1i);
}
}
let x_187 : u32 = gl_LocalInvocationID.x;
tileColA = (bitcast<i32>(x_187) * 64);
tileColA = (bitcast<i32>(x_187) * 64i);
let x_192 : u32 = gl_LocalInvocationID.y;
tileRowB = (bitcast<i32>(x_192) * 1);
t = 0;
tileRowB = (bitcast<i32>(x_192) * 1i);
t = 0i;
loop {
let x_201 : i32 = t;
let x_202 : i32 = numTiles;
@ -273,17 +273,17 @@ fn mm_matMul_i1_i1_i1_(dimAOuter : ptr<function, i32>, dimInner : ptr<function,
} else {
break;
}
innerRow_1 = 0;
innerRow_1 = 0i;
loop {
let x_210 : i32 = innerRow_1;
if ((x_210 < 1)) {
if ((x_210 < 1i)) {
} else {
break;
}
innerCol_1 = 0;
innerCol_1 = 0i;
loop {
let x_218 : i32 = innerCol_1;
if ((x_218 < 64)) {
if ((x_218 < 64i)) {
} else {
break;
}
@ -300,32 +300,32 @@ fn mm_matMul_i1_i1_i1_(dimAOuter : ptr<function, i32>, dimInner : ptr<function,
let x_238 : i32 = t;
let x_240 : i32 = inputCol;
param_3 = (x_235 + x_236);
param_4 = ((x_238 * 64) + x_240);
param_4 = ((x_238 * 64i) + x_240);
let x_244 : f32 = mm_readA_i1_i1_(&(param_3), &(param_4));
mm_Asub[x_233][x_234] = x_244;
continuing {
let x_247 : i32 = innerCol_1;
innerCol_1 = (x_247 + 1);
innerCol_1 = (x_247 + 1i);
}
}
continuing {
let x_249 : i32 = innerRow_1;
innerRow_1 = (x_249 + 1);
innerRow_1 = (x_249 + 1i);
}
}
innerRow_2 = 0;
innerRow_2 = 0i;
loop {
let x_257 : i32 = innerRow_2;
if ((x_257 < 1)) {
if ((x_257 < 1i)) {
} else {
break;
}
innerCol_2 = 0;
innerCol_2 = 0i;
loop {
let x_265 : i32 = innerCol_2;
if ((x_265 < 1)) {
if ((x_265 < 1i)) {
} else {
break;
}
@ -341,34 +341,34 @@ fn mm_matMul_i1_i1_i1_(dimAOuter : ptr<function, i32>, dimInner : ptr<function,
let x_282 : i32 = inputRow_1;
let x_284 : i32 = globalCol;
let x_285 : i32 = innerCol_2;
param_5 = ((x_280 * 64) + x_282);
param_5 = ((x_280 * 64i) + x_282);
param_6 = (x_284 + x_285);
let x_289 : f32 = mm_readB_i1_i1_(&(param_5), &(param_6));
mm_Bsub[x_278][x_279] = x_289;
continuing {
let x_291 : i32 = innerCol_2;
innerCol_2 = (x_291 + 1);
innerCol_2 = (x_291 + 1i);
}
}
continuing {
let x_293 : i32 = innerRow_2;
innerRow_2 = (x_293 + 1);
innerRow_2 = (x_293 + 1i);
}
}
workgroupBarrier();
k = 0;
k = 0i;
loop {
let x_302 : i32 = k;
if ((x_302 < 64)) {
if ((x_302 < 64i)) {
} else {
break;
}
inner = 0;
inner = 0i;
loop {
let x_310 : i32 = inner;
if ((x_310 < 1)) {
if ((x_310 < 1i)) {
} else {
break;
}
@ -381,13 +381,13 @@ fn mm_matMul_i1_i1_i1_(dimAOuter : ptr<function, i32>, dimInner : ptr<function,
continuing {
let x_322 : i32 = inner;
inner = (x_322 + 1);
inner = (x_322 + 1i);
}
}
innerRow_3 = 0;
innerRow_3 = 0i;
loop {
let x_330 : i32 = innerRow_3;
if ((x_330 < 1)) {
if ((x_330 < 1i)) {
} else {
break;
}
@ -396,10 +396,10 @@ fn mm_matMul_i1_i1_i1_(dimAOuter : ptr<function, i32>, dimInner : ptr<function,
let x_336 : i32 = k;
let x_338 : f32 = mm_Asub[(x_333 + x_334)][x_336];
ACached = x_338;
innerCol_3 = 0;
innerCol_3 = 0i;
loop {
let x_345 : i32 = innerCol_3;
if ((x_345 < 1)) {
if ((x_345 < 1i)) {
} else {
break;
}
@ -413,41 +413,41 @@ fn mm_matMul_i1_i1_i1_(dimAOuter : ptr<function, i32>, dimInner : ptr<function,
continuing {
let x_358 : i32 = innerCol_3;
innerCol_3 = (x_358 + 1);
innerCol_3 = (x_358 + 1i);
}
}
continuing {
let x_360 : i32 = innerRow_3;
innerRow_3 = (x_360 + 1);
innerRow_3 = (x_360 + 1i);
}
}
continuing {
let x_362 : i32 = k;
k = (x_362 + 1);
k = (x_362 + 1i);
}
}
workgroupBarrier();
continuing {
let x_364 : i32 = t;
t = (x_364 + 1);
t = (x_364 + 1i);
}
}
innerRow_4 = 0;
innerRow_4 = 0i;
loop {
let x_372 : i32 = innerRow_4;
if ((x_372 < 1)) {
if ((x_372 < 1i)) {
} else {
break;
}
innerCol_4 = 0;
innerCol_4 = 0i;
loop {
var x_393 : bool;
var x_394_phi : bool;
let x_380 : i32 = innerCol_4;
if ((x_380 < 1)) {
if ((x_380 < 1i)) {
} else {
break;
}
@ -480,13 +480,13 @@ fn mm_matMul_i1_i1_i1_(dimAOuter : ptr<function, i32>, dimInner : ptr<function,
continuing {
let x_411 : i32 = innerCol_4;
innerCol_4 = (x_411 + 1);
innerCol_4 = (x_411 + 1i);
}
}
continuing {
let x_413 : i32 = innerRow_4;
innerRow_4 = (x_413 + 1);
innerRow_4 = (x_413 + 1i);
}
}
return;

View File

@ -60,7 +60,7 @@ fn main_1() {
var param_1 : f32;
let x_54 : u32 = gl_GlobalInvocationID.x;
index = bitcast<i32>(x_54);
a_1 = -10;
a_1 = -10i;
let x_63 : i32 = index;
param = -4.0;
param_1 = -3.0;

View File

@ -1,5 +1,5 @@
fn f_1() {
var v : i32 = 0;
var v : i32 = 0i;
var offset_1 : u32 = 0u;
var count : u32 = 0u;
let x_16 : i32 = v;

View File

@ -1,6 +1,6 @@
fn f_1() {
var v : i32 = 0;
var n : i32 = 0;
var v : i32 = 0i;
var n : i32 = 0i;
var offset_1 : u32 = 0u;
var count : u32 = 0u;
let x_17 : i32 = v;

View File

@ -4,7 +4,7 @@ var<private> tint_symbol_1 : vec4<f32> = vec4<f32>();
fn textureLoad_6273b1() {
var res : f32 = 0.0;
let x_17 : vec4<f32> = vec4<f32>(textureLoad(arg_0, vec2<i32>(), 1), 0.0, 0.0, 0.0);
let x_17 : vec4<f32> = vec4<f32>(textureLoad(arg_0, vec2<i32>(), 1i), 0.0, 0.0, 0.0);
res = x_17.x;
return;
}

View File

@ -3,7 +3,7 @@
var<private> tint_symbol_1 : vec4<f32> = vec4<f32>();
fn textureNumSamples_a3c8a0() {
var res : i32 = 0;
var res : i32 = 0i;
let x_16 : i32 = textureNumSamples(arg_0);
res = x_16;
return;

View File

@ -1,7 +1,7 @@
fn main_1() {
var m : mat3x3<f32> = mat3x3<f32>();
m = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0));
m[1] = vec3<f32>(5.0, 5.0, 5.0);
m[1i] = vec3<f32>(5.0, 5.0, 5.0);
return;
}

View File

@ -1,8 +1,8 @@
var<private> I : i32 = 0;
var<private> I : i32 = 0i;
fn main_1() {
let x_9 : i32 = I;
let x_11 : i32 = (x_9 + 1);
let x_11 : i32 = (x_9 + 1i);
return;
}

View File

@ -1,8 +1,8 @@
fn main_1() {
var i : i32 = 0;
i = 123;
var i : i32 = 0i;
i = 123i;
let x_10 : i32 = i;
let x_12 : i32 = (x_10 + 1);
let x_12 : i32 = (x_10 + 1i);
return;
}

View File

@ -4,8 +4,8 @@ fn func(value : i32, pointer : ptr<function, i32>) -> i32 {
}
fn main_1() {
var i : i32 = 0;
i = 123;
var i : i32 = 0i;
i = 123i;
let x_19 : i32 = i;
let x_18 : i32 = func(x_19, &(i));
return;

View File

@ -1,8 +1,8 @@
var<private> I : i32 = 0;
var<private> I : i32 = 0i;
fn main_1() {
I = 123;
I = ((100 + 20) + 3);
I = 123i;
I = ((100i + 20i) + 3i);
return;
}

View File

@ -5,7 +5,7 @@ struct S {
var<private> V : S;
fn main_1() {
V.i = 5;
V.i = 5i;
return;
}

View File

@ -1,8 +1,8 @@
fn main_1() {
var i : i32 = 0;
i = 123;
i = 123;
i = ((100 + 20) + 3);
var i : i32 = 0i;
i = 123i;
i = 123i;
i = ((100i + 20i) + 3i);
return;
}

View File

@ -4,7 +4,7 @@ struct S {
fn main_1() {
var V : S;
V.i = 5;
V.i = 5i;
return;
}

View File

@ -4,9 +4,9 @@ fn func(value : i32, pointer : ptr<function, i32>) {
}
fn main_1() {
var i : i32 = 0;
i = 123;
func(123, &(i));
var i : i32 = 0i;
i = 123i;
func(123i, &(i));
return;
}