tint: const eval of reverseBits

Bug: tint:1581
Change-Id: I3dd1ea2c774f9fc0dff87b71f25375a469c3d05e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108300
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Antonio Maiorano 2022-11-04 13:48:26 +00:00 committed by Dawn LUCI CQ
parent 23a35c8a26
commit 6fcc4f3a54
45 changed files with 274 additions and 200 deletions

View File

@ -520,8 +520,8 @@ fn radians<T: f32_f16>(T) -> T
fn radians<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
fn reflect<N: num, T: f32_f16>(vec<N, T>, vec<N, T>) -> vec<N, T>
fn refract<N: num, T: f32_f16>(vec<N, T>, vec<N, T>, T) -> vec<N, T>
fn reverseBits<T: iu32>(T) -> T
fn reverseBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
@const fn reverseBits<T: iu32>(T) -> T
@const fn reverseBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
fn round<T: f32_f16>(T) -> T
fn round<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
@const fn saturate<T: fa_f32_f16>(@test_value(2) T) -> T

View File

@ -1822,7 +1822,7 @@ ConstEval::Result ConstEval::extractBits(const sem::Type* ty,
// Only need to set other bits if bit at c - 1 of result is 1
if ((r & (UT{1} << (c - UT{1}))) != UT{0}) {
UT dst_mask = src_mask >> o;
r = r | (~UT{0} & ~dst_mask);
r |= (~UT{0} & ~dst_mask);
}
}
@ -1956,9 +1956,9 @@ ConstEval::Result ConstEval::insertBits(const sem::Type* ty,
// newbits. Other bits of the result are copied from e.
UT from = newbits << o;
UT mask = ((UT{1} << c) - UT{1}) << UT{o};
auto r = e; // Start with 'e' as the result
r = r & ~mask; // Zero the bits in 'e' we're overwriting
r = r | (from & mask); // Overwrite from 'newbits' (shifted into position)
auto r = e; // Start with 'e' as the result
r &= ~mask; // Zero the bits in 'e' we're overwriting
r |= (from & mask); // Overwrite from 'newbits' (shifted into position)
result = NumberT{r};
}
@ -1969,6 +1969,33 @@ ConstEval::Result ConstEval::insertBits(const sem::Type* ty,
return TransformElements(builder, ty, transform, args[0], args[1]);
}
ConstEval::Result ConstEval::reverseBits(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source&) {
auto transform = [&](const sem::Constant* c0) {
auto create = [&](auto in_e) -> ImplResult {
using NumberT = decltype(in_e);
using T = UnwrapNumber<NumberT>;
using UT = std::make_unsigned_t<T>;
constexpr UT kNumBits = sizeof(UT) * 8;
UT e = static_cast<UT>(in_e);
UT r = UT{0};
for (size_t s = 0; s < kNumBits; ++s) {
// Write source 's' bit to destination 'd' bit if 1
if (e & (UT{1} << s)) {
size_t d = kNumBits - s - 1;
r |= (UT{1} << d);
}
}
return CreateElement(builder, c0->Type(), NumberT{r});
};
return Dispatch_iu32(create, c0);
};
return TransformElements(builder, ty, transform, args[0]);
}
ConstEval::Result ConstEval::saturate(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source&) {

View File

@ -509,8 +509,8 @@ class ConstEval {
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result extractBits(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// firstLeadingBit builtin
/// @param ty the expression type
@ -548,6 +548,15 @@ class ConstEval {
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// reverseBits 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 reverseBits(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// saturate builtin
/// @param ty the expression type
/// @param args the input arguments

View File

@ -1106,6 +1106,52 @@ INSTANTIATE_TEST_SUITE_P(ExtractBits,
std::make_tuple(1000, 1000), //
std::make_tuple(u32::Highest(), u32::Highest())));
template <typename T>
std::vector<Case> ReverseBitsCases() {
using B = BitValues<T>;
return {
C({T(0)}, T(0)),
C({B::Lsh(1, 0)}, B::Lsh(1, 31)), //
C({B::Lsh(1, 1)}, B::Lsh(1, 30)), //
C({B::Lsh(1, 2)}, B::Lsh(1, 29)), //
C({B::Lsh(1, 3)}, B::Lsh(1, 28)), //
C({B::Lsh(1, 4)}, B::Lsh(1, 27)), //
//...
C({B::Lsh(1, 27)}, B::Lsh(1, 4)), //
C({B::Lsh(1, 28)}, B::Lsh(1, 3)), //
C({B::Lsh(1, 29)}, B::Lsh(1, 2)), //
C({B::Lsh(1, 30)}, B::Lsh(1, 1)), //
C({B::Lsh(1, 31)}, B::Lsh(1, 0)), //
C({/**/ T(0b00010001000100010000000000000000)},
/* */ T(0b00000000000000001000100010001000)),
C({/**/ T(0b00011000000110000000000000000000)},
/* */ T(0b00000000000000000001100000011000)),
C({/**/ T(0b00000100000000001111111111111111)},
/* */ T(0b11111111111111110000000000100000)),
C({/**/ T(0b10010101111000110000011111101010)},
/* */ T(0b01010111111000001100011110101001)),
// Vector tests
C({/**/ Vec(T(0b00010001000100010000000000000000), //
T(0b00011000000110000000000000000000), //
T(0b00000000000000001111111111111111))},
/* */ Vec(T(0b00000000000000001000100010001000), //
T(0b00000000000000000001100000011000), //
T(0b11111111111111110000000000000000))),
};
}
INSTANTIATE_TEST_SUITE_P( //
ReverseBits,
ResolverConstEvalBuiltinTest,
testing::Combine(testing::Values(sem::BuiltinType::kReverseBits),
testing::ValuesIn(Concat(ReverseBitsCases<i32>(), //
ReverseBitsCases<u32>()))));
template <typename T>
std::vector<Case> SaturateCases() {
return {

View File

@ -12398,7 +12398,7 @@ constexpr OverloadInfo kOverloads[] = {
/* parameters */ &kParameters[869],
/* return matcher indices */ &kMatcherIndices[1],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr,
/* const eval */ &ConstEval::reverseBits,
},
{
/* [339] */
@ -12410,7 +12410,7 @@ constexpr OverloadInfo kOverloads[] = {
/* parameters */ &kParameters[868],
/* return matcher indices */ &kMatcherIndices[30],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr,
/* const eval */ &ConstEval::reverseBits,
},
{
/* [340] */

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_222177() {
int2 res = reverse_bits(int2(1));
int2 res = int2((-2147483647 - 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
@ -32,38 +32,37 @@
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%int_1 = OpConstant %int 1
%17 = OpConstantComposite %v2int %int_1 %int_1
%int_n2147483648 = OpConstant %int -2147483648
%16 = OpConstantComposite %v2int %int_n2147483648 %int_n2147483648
%_ptr_Function_v2int = OpTypePointer Function %v2int
%20 = OpConstantNull %v2int
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v2int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%reverseBits_222177 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2int Function %20
%13 = OpBitReverse %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 %reverseBits_222177
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %reverseBits_222177
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 %reverseBits_222177
%29 = OpLabel
%30 = OpFunctionCall %void %reverseBits_222177
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %reverseBits_222177
%32 = OpLabel
%33 = OpFunctionCall %void %reverseBits_222177
OpReturn
OpFunctionEnd

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_35fea9() {
uint4 res = reverse_bits(uint4(1u));
uint4 res = uint4(2147483648u);
}
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
@ -32,38 +32,37 @@
%9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4
%uint_1 = OpConstant %uint 1
%17 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
%uint_2147483648 = OpConstant %uint 2147483648
%16 = OpConstantComposite %v4uint %uint_2147483648 %uint_2147483648 %uint_2147483648 %uint_2147483648
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
%20 = OpConstantNull %v4uint
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v4uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%reverseBits_35fea9 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4uint Function %20
%13 = OpBitReverse %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 %reverseBits_35fea9
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %reverseBits_35fea9
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 %reverseBits_35fea9
%29 = OpLabel
%30 = OpFunctionCall %void %reverseBits_35fea9
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %reverseBits_35fea9
%32 = OpLabel
%33 = OpFunctionCall %void %reverseBits_35fea9
OpReturn
OpFunctionEnd

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_4dbd6f() {
int4 res = reverse_bits(int4(1));
int4 res = int4((-2147483647 - 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
@ -32,38 +32,37 @@
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4
%int_1 = OpConstant %int 1
%17 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_n2147483648 = OpConstant %int -2147483648
%16 = OpConstantComposite %v4int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n2147483648
%_ptr_Function_v4int = OpTypePointer Function %v4int
%20 = OpConstantNull %v4int
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v4int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%reverseBits_4dbd6f = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4int Function %20
%13 = OpBitReverse %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 %reverseBits_4dbd6f
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %reverseBits_4dbd6f
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 %reverseBits_4dbd6f
%29 = OpLabel
%30 = OpFunctionCall %void %reverseBits_4dbd6f
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %reverseBits_4dbd6f
%32 = OpLabel
%33 = OpFunctionCall %void %reverseBits_4dbd6f
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void reverseBits_7c4269() {
int res = asint(reversebits(asuint(1)));
int res = -2147483648;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void reverseBits_7c4269() {
int res = asint(reversebits(asuint(1)));
int res = -2147483648;
}
struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_7c4269() {
int res = reverse_bits(1);
int res = (-2147483647 - 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
@ -31,37 +31,36 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_n2147483648 = OpConstant %int -2147483648
%_ptr_Function_int = OpTypePointer Function %int
%18 = OpConstantNull %int
%19 = OpTypeFunction %v4float
%17 = OpConstantNull %int
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%reverseBits_7c4269 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_int Function %18
%13 = OpBitReverse %int %int_1
OpStore %res %13
%res = OpVariable %_ptr_Function_int Function %17
OpStore %res %int_n2147483648
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %reverseBits_7c4269
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %reverseBits_7c4269
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 %reverseBits_7c4269
%27 = OpLabel
%28 = OpFunctionCall %void %reverseBits_7c4269
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%31 = OpLabel
%32 = OpFunctionCall %void %reverseBits_7c4269
%30 = OpLabel
%31 = OpFunctionCall %void %reverseBits_7c4269
OpReturn
OpFunctionEnd

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_a6ccd4() {
uint3 res = reverse_bits(uint3(1u));
uint3 res = uint3(2147483648u);
}
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
@ -32,38 +32,37 @@
%9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%uint_1 = OpConstant %uint 1
%17 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%uint_2147483648 = OpConstant %uint 2147483648
%16 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%20 = OpConstantNull %v3uint
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v3uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%reverseBits_a6ccd4 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3uint Function %20
%13 = OpBitReverse %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 %reverseBits_a6ccd4
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %reverseBits_a6ccd4
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 %reverseBits_a6ccd4
%29 = OpLabel
%30 = OpFunctionCall %void %reverseBits_a6ccd4
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %reverseBits_a6ccd4
%32 = OpLabel
%33 = OpFunctionCall %void %reverseBits_a6ccd4
OpReturn
OpFunctionEnd

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_c21bc1() {
int3 res = reverse_bits(int3(1));
int3 res = int3((-2147483647 - 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
@ -32,38 +32,37 @@
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%int_1 = OpConstant %int 1
%17 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%int_n2147483648 = OpConstant %int -2147483648
%16 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648
%_ptr_Function_v3int = OpTypePointer Function %v3int
%20 = OpConstantNull %v3int
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v3int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%reverseBits_c21bc1 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3int Function %20
%13 = OpBitReverse %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 %reverseBits_c21bc1
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %reverseBits_c21bc1
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 %reverseBits_c21bc1
%29 = OpLabel
%30 = OpFunctionCall %void %reverseBits_c21bc1
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %reverseBits_c21bc1
%32 = OpLabel
%33 = OpFunctionCall %void %reverseBits_c21bc1
OpReturn
OpFunctionEnd

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_e1f4c1() {
uint2 res = reverse_bits(uint2(1u));
uint2 res = uint2(2147483648u);
}
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
@ -32,38 +32,37 @@
%9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
%17 = OpConstantComposite %v2uint %uint_1 %uint_1
%uint_2147483648 = OpConstant %uint 2147483648
%16 = OpConstantComposite %v2uint %uint_2147483648 %uint_2147483648
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
%20 = OpConstantNull %v2uint
%21 = OpTypeFunction %v4float
%19 = OpConstantNull %v2uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%reverseBits_e1f4c1 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2uint Function %20
%13 = OpBitReverse %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 %reverseBits_e1f4c1
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %reverseBits_e1f4c1
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 %reverseBits_e1f4c1
%29 = OpLabel
%30 = OpFunctionCall %void %reverseBits_e1f4c1
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %reverseBits_e1f4c1
%32 = OpLabel
%33 = OpFunctionCall %void %reverseBits_e1f4c1
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void reverseBits_e31adf() {
uint res = reversebits(1u);
uint res = 2147483648u;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void reverseBits_e31adf() {
uint res = reversebits(1u);
uint res = 2147483648u;
}
struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_e31adf() {
uint res = reverse_bits(1u);
uint res = 2147483648u;
}
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
@ -31,37 +31,36 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%uint_2147483648 = OpConstant %uint 2147483648
%_ptr_Function_uint = OpTypePointer Function %uint
%18 = OpConstantNull %uint
%19 = OpTypeFunction %v4float
%17 = OpConstantNull %uint
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%reverseBits_e31adf = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_uint Function %18
%13 = OpBitReverse %uint %uint_1
OpStore %res %13
%res = OpVariable %_ptr_Function_uint Function %17
OpStore %res %uint_2147483648
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %reverseBits_e31adf
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %reverseBits_e31adf
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 %reverseBits_e31adf
%27 = OpLabel
%28 = OpFunctionCall %void %reverseBits_e31adf
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%31 = OpLabel
%32 = OpFunctionCall %void %reverseBits_e31adf
%30 = OpLabel
%31 = OpFunctionCall %void %reverseBits_e31adf
OpReturn
OpFunctionEnd