tint: const eval of countOneBits

Bug: tint:1581
Change-Id: I156cbd162010d28ec25b410220638e810fc34c98
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107701
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano 2022-10-31 18:44:15 +00:00 committed by Dawn LUCI CQ
parent 68ed8d92d3
commit 76c21c070b
46 changed files with 250 additions and 196 deletions

View File

@ -435,8 +435,8 @@ fn cosh<T: f32_f16>(T) -> T
fn cosh<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
@const fn countLeadingZeros<T: iu32>(T) -> T
@const fn countLeadingZeros<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
fn countOneBits<T: iu32>(T) -> T
fn countOneBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
@const fn countOneBits<T: iu32>(T) -> T
@const fn countOneBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
@const fn countTrailingZeros<T: iu32>(T) -> T
@const fn countTrailingZeros<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
fn cross<T: f32_f16>(vec3<T>, vec3<T>) -> vec3<T>

View File

@ -1657,6 +1657,30 @@ ConstEval::Result ConstEval::countLeadingZeros(const sem::Type* ty,
return TransformElements(builder, ty, transform, args[0]);
}
ConstEval::Result ConstEval::countOneBits(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source&) {
auto transform = [&](const sem::Constant* c0) {
auto create = [&](auto e) {
using NumberT = decltype(e);
using T = UnwrapNumber<NumberT>;
using UT = std::make_unsigned_t<T>;
constexpr UT kRightMost = UT{1};
auto count = UT{0};
for (auto v = static_cast<UT>(e); v != UT{0}; v >>= 1) {
if ((v & kRightMost) == 1) {
++count;
}
}
return CreateElement(builder, c0->Type(), NumberT(count));
};
return Dispatch_iu32(create, c0);
};
return TransformElements(builder, ty, transform, args[0]);
}
ConstEval::Result ConstEval::countTrailingZeros(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source&) {

View File

@ -449,6 +449,15 @@ class ConstEval {
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// countOneBits builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result countOneBits(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// countTrailingZeros builtin
/// @param ty the expression type
/// @param args the input arguments

View File

@ -581,6 +581,43 @@ INSTANTIATE_TEST_SUITE_P( //
testing::ValuesIn(Concat(CountTrailingZerosCases<i32>(), //
CountTrailingZerosCases<u32>()))));
template <typename T>
std::vector<Case> CountOneBitsCases() {
using B = BitValues<T>;
return {
C({T(0)}, T(0)), //
C({B::Lsh(1, 31)}, T(1)), //
C({B::Lsh(1, 30)}, T(1)), //
C({B::Lsh(1, 29)}, T(1)), //
C({B::Lsh(1, 28)}, T(1)),
//...
C({B::Lsh(1, 3)}, T(1)), //
C({B::Lsh(1, 2)}, T(1)), //
C({B::Lsh(1, 1)}, T(1)), //
C({B::Lsh(1, 0)}, T(1)),
C({T(0b1010'1010'1010'1010'1010'1010'1010'1010)}, T(16)),
C({T(0b0000'1111'0000'1111'0000'1111'0000'1111)}, T(16)),
C({T(0b0101'0000'0000'0000'0000'0000'0000'0101)}, T(4)),
// Vector tests
C({Vec(B::Lsh(1, 31), B::Lsh(1, 30), B::Lsh(1, 29))}, Vec(T(1), T(1), T(1))),
C({Vec(B::Lsh(1, 2), B::Lsh(1, 1), B::Lsh(1, 0))}, Vec(T(1), T(1), T(1))),
C({Vec(T(0b1010'1010'1010'1010'1010'1010'1010'1010),
T(0b0000'1111'0000'1111'0000'1111'0000'1111),
T(0b0101'0000'0000'0000'0000'0000'0000'0101))},
Vec(T(16), T(16), T(4))),
};
}
INSTANTIATE_TEST_SUITE_P( //
CountOneBits,
ResolverConstEvalBuiltinTest,
testing::Combine(testing::Values(sem::BuiltinType::kCountOneBits),
testing::ValuesIn(Concat(CountOneBitsCases<i32>(), //
CountOneBitsCases<u32>()))));
template <typename T>
std::vector<Case> SaturateCases() {
return {

View File

@ -12964,7 +12964,7 @@ constexpr OverloadInfo kOverloads[] = {
/* parameters */ &kParameters[944],
/* return matcher indices */ &kMatcherIndices[1],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr,
/* const eval */ &ConstEval::countOneBits,
},
{
/* [387] */
@ -12976,7 +12976,7 @@ constexpr OverloadInfo kOverloads[] = {
/* parameters */ &kParameters[932],
/* return matcher indices */ &kMatcherIndices[30],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr,
/* const eval */ &ConstEval::countOneBits,
},
{
/* [388] */

View File

@ -1,5 +1,5 @@
void countOneBits_0d0e46() {
uint4 res = countbits((1u).xxxx);
uint4 res = (1u).xxxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void countOneBits_0d0e46() {
uint4 res = countbits((1u).xxxx);
uint4 res = (1u).xxxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void countOneBits_0d0e46() {
uvec4 res = uvec4(bitCount(uvec4(1u)));
uvec4 res = uvec4(1u);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void countOneBits_0d0e46() {
uvec4 res = uvec4(bitCount(uvec4(1u)));
uvec4 res = uvec4(1u);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void countOneBits_0d0e46() {
uvec4 res = uvec4(bitCount(uvec4(1u)));
uvec4 res = uvec4(1u);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void countOneBits_0d0e46() {
uint4 res = popcount(uint4(1u));
uint4 res = uint4(1u);
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 35
; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@ -33,37 +33,36 @@
%uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4
%uint_1 = OpConstant %uint 1
%17 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
%16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
%20 = OpConstantNull %v4uint
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v4uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%countOneBits_0d0e46 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4uint Function %20
%13 = OpBitCount %v4uint %17
OpStore %res %13
%res = OpVariable %_ptr_Function_v4uint Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %countOneBits_0d0e46
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %countOneBits_0d0e46
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %countOneBits_0d0e46
%29 = OpLabel
%30 = OpFunctionCall %void %countOneBits_0d0e46
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %countOneBits_0d0e46
%32 = OpLabel
%33 = OpFunctionCall %void %countOneBits_0d0e46
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void countOneBits_0f7980() {
int4 res = asint(countbits(asuint((1).xxxx)));
int4 res = (1).xxxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void countOneBits_0f7980() {
int4 res = asint(countbits(asuint((1).xxxx)));
int4 res = (1).xxxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void countOneBits_0f7980() {
ivec4 res = ivec4(bitCount(ivec4(1)));
ivec4 res = ivec4(1);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void countOneBits_0f7980() {
ivec4 res = ivec4(bitCount(ivec4(1)));
ivec4 res = ivec4(1);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void countOneBits_0f7980() {
ivec4 res = ivec4(bitCount(ivec4(1)));
ivec4 res = ivec4(1);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void countOneBits_0f7980() {
int4 res = popcount(int4(1));
int4 res = int4(1);
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 35
; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@ -33,37 +33,36 @@
%int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4
%int_1 = OpConstant %int 1
%17 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%_ptr_Function_v4int = OpTypePointer Function %v4int
%20 = OpConstantNull %v4int
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v4int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%countOneBits_0f7980 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4int Function %20
%13 = OpBitCount %v4int %17
OpStore %res %13
%res = OpVariable %_ptr_Function_v4int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %countOneBits_0f7980
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %countOneBits_0f7980
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %countOneBits_0f7980
%29 = OpLabel
%30 = OpFunctionCall %void %countOneBits_0f7980
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %countOneBits_0f7980
%32 = OpLabel
%33 = OpFunctionCall %void %countOneBits_0f7980
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void countOneBits_65d2ae() {
int3 res = asint(countbits(asuint((1).xxx)));
int3 res = (1).xxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void countOneBits_65d2ae() {
int3 res = asint(countbits(asuint((1).xxx)));
int3 res = (1).xxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void countOneBits_65d2ae() {
ivec3 res = ivec3(bitCount(ivec3(1)));
ivec3 res = ivec3(1);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void countOneBits_65d2ae() {
ivec3 res = ivec3(bitCount(ivec3(1)));
ivec3 res = ivec3(1);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void countOneBits_65d2ae() {
ivec3 res = ivec3(bitCount(ivec3(1)));
ivec3 res = ivec3(1);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void countOneBits_65d2ae() {
int3 res = popcount(int3(1));
int3 res = int3(1);
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 35
; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@ -33,37 +33,36 @@
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%int_1 = OpConstant %int 1
%17 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%16 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%_ptr_Function_v3int = OpTypePointer Function %v3int
%20 = OpConstantNull %v3int
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v3int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%countOneBits_65d2ae = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3int Function %20
%13 = OpBitCount %v3int %17
OpStore %res %13
%res = OpVariable %_ptr_Function_v3int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %countOneBits_65d2ae
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %countOneBits_65d2ae
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %countOneBits_65d2ae
%29 = OpLabel
%30 = OpFunctionCall %void %countOneBits_65d2ae
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %countOneBits_65d2ae
%32 = OpLabel
%33 = OpFunctionCall %void %countOneBits_65d2ae
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void countOneBits_690cfc() {
uint3 res = countbits((1u).xxx);
uint3 res = (1u).xxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void countOneBits_690cfc() {
uint3 res = countbits((1u).xxx);
uint3 res = (1u).xxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void countOneBits_690cfc() {
uvec3 res = uvec3(bitCount(uvec3(1u)));
uvec3 res = uvec3(1u);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void countOneBits_690cfc() {
uvec3 res = uvec3(bitCount(uvec3(1u)));
uvec3 res = uvec3(1u);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void countOneBits_690cfc() {
uvec3 res = uvec3(bitCount(uvec3(1u)));
uvec3 res = uvec3(1u);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void countOneBits_690cfc() {
uint3 res = popcount(uint3(1u));
uint3 res = uint3(1u);
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 35
; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@ -33,37 +33,36 @@
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%uint_1 = OpConstant %uint 1
%17 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%20 = OpConstantNull %v3uint
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v3uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%countOneBits_690cfc = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3uint Function %20
%13 = OpBitCount %v3uint %17
OpStore %res %13
%res = OpVariable %_ptr_Function_v3uint Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %countOneBits_690cfc
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %countOneBits_690cfc
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %countOneBits_690cfc
%29 = OpLabel
%30 = OpFunctionCall %void %countOneBits_690cfc
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %countOneBits_690cfc
%32 = OpLabel
%33 = OpFunctionCall %void %countOneBits_690cfc
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void countOneBits_94fd81() {
uint2 res = countbits((1u).xx);
uint2 res = (1u).xx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void countOneBits_94fd81() {
uint2 res = countbits((1u).xx);
uint2 res = (1u).xx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void countOneBits_94fd81() {
uvec2 res = uvec2(bitCount(uvec2(1u)));
uvec2 res = uvec2(1u);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void countOneBits_94fd81() {
uvec2 res = uvec2(bitCount(uvec2(1u)));
uvec2 res = uvec2(1u);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void countOneBits_94fd81() {
uvec2 res = uvec2(bitCount(uvec2(1u)));
uvec2 res = uvec2(1u);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void countOneBits_94fd81() {
uint2 res = popcount(uint2(1u));
uint2 res = uint2(1u);
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 35
; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@ -33,37 +33,36 @@
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
%17 = OpConstantComposite %v2uint %uint_1 %uint_1
%16 = OpConstantComposite %v2uint %uint_1 %uint_1
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
%20 = OpConstantNull %v2uint
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v2uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%countOneBits_94fd81 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2uint Function %20
%13 = OpBitCount %v2uint %17
OpStore %res %13
%res = OpVariable %_ptr_Function_v2uint Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %countOneBits_94fd81
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %countOneBits_94fd81
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %countOneBits_94fd81
%29 = OpLabel
%30 = OpFunctionCall %void %countOneBits_94fd81
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %countOneBits_94fd81
%32 = OpLabel
%33 = OpFunctionCall %void %countOneBits_94fd81
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void countOneBits_ae44f9() {
uint res = countbits(1u);
uint res = 1u;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void countOneBits_ae44f9() {
uint res = countbits(1u);
uint res = 1u;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void countOneBits_ae44f9() {
uint res = uint(bitCount(1u));
uint res = 1u;
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void countOneBits_ae44f9() {
uint res = uint(bitCount(1u));
uint res = 1u;
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void countOneBits_ae44f9() {
uint res = uint(bitCount(1u));
uint res = 1u;
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void countOneBits_ae44f9() {
uint res = popcount(1u);
uint res = 1u;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 33
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@ -33,35 +33,34 @@
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_uint = OpTypePointer Function %uint
%18 = OpConstantNull %uint
%19 = OpTypeFunction %v4float
%17 = OpConstantNull %uint
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%countOneBits_ae44f9 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_uint Function %18
%13 = OpBitCount %uint %uint_1
OpStore %res %13
%res = OpVariable %_ptr_Function_uint Function %17
OpStore %res %uint_1
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %countOneBits_ae44f9
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %countOneBits_ae44f9
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%24 = OpLabel
%25 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %25
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%28 = OpLabel
%29 = OpFunctionCall %void %countOneBits_ae44f9
%27 = OpLabel
%28 = OpFunctionCall %void %countOneBits_ae44f9
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%31 = OpLabel
%32 = OpFunctionCall %void %countOneBits_ae44f9
%30 = OpLabel
%31 = OpFunctionCall %void %countOneBits_ae44f9
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void countOneBits_af90e2() {
int2 res = asint(countbits(asuint((1).xx)));
int2 res = (1).xx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void countOneBits_af90e2() {
int2 res = asint(countbits(asuint((1).xx)));
int2 res = (1).xx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void countOneBits_af90e2() {
ivec2 res = ivec2(bitCount(ivec2(1)));
ivec2 res = ivec2(1);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void countOneBits_af90e2() {
ivec2 res = ivec2(bitCount(ivec2(1)));
ivec2 res = ivec2(1);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void countOneBits_af90e2() {
ivec2 res = ivec2(bitCount(ivec2(1)));
ivec2 res = ivec2(1);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void countOneBits_af90e2() {
int2 res = popcount(int2(1));
int2 res = int2(1);
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 35
; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@ -33,37 +33,36 @@
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%int_1 = OpConstant %int 1
%17 = OpConstantComposite %v2int %int_1 %int_1
%16 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v2int = OpTypePointer Function %v2int
%20 = OpConstantNull %v2int
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v2int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%countOneBits_af90e2 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2int Function %20
%13 = OpBitCount %v2int %17
OpStore %res %13
%res = OpVariable %_ptr_Function_v2int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %countOneBits_af90e2
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %countOneBits_af90e2
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %countOneBits_af90e2
%29 = OpLabel
%30 = OpFunctionCall %void %countOneBits_af90e2
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %countOneBits_af90e2
%32 = OpLabel
%33 = OpFunctionCall %void %countOneBits_af90e2
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void countOneBits_fd88b2() {
int res = asint(countbits(asuint(1)));
int res = 1;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void countOneBits_fd88b2() {
int res = asint(countbits(asuint(1)));
int res = 1;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void countOneBits_fd88b2() {
int res = int(bitCount(1));
int res = 1;
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void countOneBits_fd88b2() {
int res = int(bitCount(1));
int res = 1;
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void countOneBits_fd88b2() {
int res = int(bitCount(1));
int res = 1;
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void countOneBits_fd88b2() {
int res = popcount(1);
int res = 1;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 33
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@ -33,35 +33,34 @@
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_int = OpTypePointer Function %int
%18 = OpConstantNull %int
%19 = OpTypeFunction %v4float
%17 = OpConstantNull %int
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%countOneBits_fd88b2 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_int Function %18
%13 = OpBitCount %int %int_1
OpStore %res %13
%res = OpVariable %_ptr_Function_int Function %17
OpStore %res %int_1
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %countOneBits_fd88b2
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %countOneBits_fd88b2
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%24 = OpLabel
%25 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %25
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%28 = OpLabel
%29 = OpFunctionCall %void %countOneBits_fd88b2
%27 = OpLabel
%28 = OpFunctionCall %void %countOneBits_fd88b2
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%31 = OpLabel
%32 = OpFunctionCall %void %countOneBits_fd88b2
%30 = OpLabel
%31 = OpFunctionCall %void %countOneBits_fd88b2
OpReturn
OpFunctionEnd

View File

@ -466,14 +466,6 @@ crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countLeading
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="const";vectorize=2 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="const";vectorize=3 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="const";vectorize=4 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="const";vectorize="_undef_" [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="const";vectorize=2 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="const";vectorize=3 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="const";vectorize=4 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="const";vectorize="_undef_" [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="const";vectorize=2 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="const";vectorize=3 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="const";vectorize=4 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="const";vectorize="_undef_" [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="const";vectorize=2 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="const";vectorize=3 [ Failure ]