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>
diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def
index 14b00f8..f497405 100644
--- a/src/tint/intrinsics.def
+++ b/src/tint/intrinsics.def
@@ -520,8 +520,8 @@
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
diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc
index b8c4d56..2554dc8 100644
--- a/src/tint/resolver/const_eval.cc
+++ b/src/tint/resolver/const_eval.cc
@@ -1822,7 +1822,7 @@
// 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 @@
// 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 @@
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&) {
diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h
index a2a2dd1..f309150 100644
--- a/src/tint/resolver/const_eval.h
+++ b/src/tint/resolver/const_eval.h
@@ -509,8 +509,8 @@
/// @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 @@
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
diff --git a/src/tint/resolver/const_eval_builtin_test.cc b/src/tint/resolver/const_eval_builtin_test.cc
index be01921..74ac16f 100644
--- a/src/tint/resolver/const_eval_builtin_test.cc
+++ b/src/tint/resolver/const_eval_builtin_test.cc
@@ -1107,6 +1107,52 @@
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 {
C({T(0)}, T(0)),
diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl
index 307843c..ddce1ba 100644
--- a/src/tint/resolver/intrinsic_table.inl
+++ b/src/tint/resolver/intrinsic_table.inl
@@ -12398,7 +12398,7 @@
/* 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 @@
/* 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] */
diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.dxc.hlsl
index 2ea66b6..e62cccb 100644
--- a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_222177() {
- int2 res = asint(reversebits(asuint((1).xx)));
+ int2 res = (-2147483648).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.fxc.hlsl
index 2ea66b6..e62cccb 100644
--- a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_222177() {
- int2 res = asint(reversebits(asuint((1).xx)));
+ int2 res = (-2147483648).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.glsl
index 599d35a..317a798 100644
--- a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.glsl
@@ -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 @@
precision mediump float;
void reverseBits_222177() {
- ivec2 res = bitfieldReverse(ivec2(1));
+ ivec2 res = ivec2(-2147483648);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void reverseBits_222177() {
- ivec2 res = bitfieldReverse(ivec2(1));
+ ivec2 res = ivec2(-2147483648);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.msl
index a9283f6..517d05b 100644
--- a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_222177() {
- int2 res = reverse_bits(int2(1));
+ int2 res = int2((-2147483647 - 1));
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.spvasm
index 7fe7741..1428353 100644
--- a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.spvasm
@@ -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
diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.dxc.hlsl
index dab85fe..ced6ec0 100644
--- a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_35fea9() {
- uint4 res = reversebits((1u).xxxx);
+ uint4 res = (2147483648u).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.fxc.hlsl
index dab85fe..ced6ec0 100644
--- a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_35fea9() {
- uint4 res = reversebits((1u).xxxx);
+ uint4 res = (2147483648u).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.glsl
index cf80319..ca78653 100644
--- a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.glsl
@@ -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 @@
precision mediump float;
void reverseBits_35fea9() {
- uvec4 res = bitfieldReverse(uvec4(1u));
+ uvec4 res = uvec4(2147483648u);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void reverseBits_35fea9() {
- uvec4 res = bitfieldReverse(uvec4(1u));
+ uvec4 res = uvec4(2147483648u);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.msl
index af6ec6c..f8b986a 100644
--- a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_35fea9() {
- uint4 res = reverse_bits(uint4(1u));
+ uint4 res = uint4(2147483648u);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.spvasm
index 64647f4..a9ef7e5 100644
--- a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.spvasm
@@ -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
diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.dxc.hlsl
index 73a433b..aa81049 100644
--- a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_4dbd6f() {
- int4 res = asint(reversebits(asuint((1).xxxx)));
+ int4 res = (-2147483648).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.fxc.hlsl
index 73a433b..aa81049 100644
--- a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_4dbd6f() {
- int4 res = asint(reversebits(asuint((1).xxxx)));
+ int4 res = (-2147483648).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.glsl
index 0d096c5..46772b0 100644
--- a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.glsl
@@ -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 @@
precision mediump float;
void reverseBits_4dbd6f() {
- ivec4 res = bitfieldReverse(ivec4(1));
+ ivec4 res = ivec4(-2147483648);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void reverseBits_4dbd6f() {
- ivec4 res = bitfieldReverse(ivec4(1));
+ ivec4 res = ivec4(-2147483648);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.msl
index f148edc..5a5de8b 100644
--- a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_4dbd6f() {
- int4 res = reverse_bits(int4(1));
+ int4 res = int4((-2147483647 - 1));
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.spvasm
index f8dfbb6..2e97a0b 100644
--- a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.spvasm
@@ -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
diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.dxc.hlsl
index b2796a2..03c8356 100644
--- a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_7c4269() {
- int res = asint(reversebits(asuint(1)));
+ int res = -2147483648;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.fxc.hlsl
index b2796a2..03c8356 100644
--- a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_7c4269() {
- int res = asint(reversebits(asuint(1)));
+ int res = -2147483648;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.glsl
index 390dad5..b49fd5d 100644
--- a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void reverseBits_7c4269() {
- int res = bitfieldReverse(1);
+ int res = -2147483648;
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void reverseBits_7c4269() {
- int res = bitfieldReverse(1);
+ int res = -2147483648;
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void reverseBits_7c4269() {
- int res = bitfieldReverse(1);
+ int res = -2147483648;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.msl
index 90d843c..d866776 100644
--- a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_7c4269() {
- int res = reverse_bits(1);
+ int res = (-2147483647 - 1);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.spvasm
index 1811bbc..099ac7e 100644
--- a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.spvasm
@@ -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
diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.dxc.hlsl
index 99e125a..ae2987c 100644
--- a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_a6ccd4() {
- uint3 res = reversebits((1u).xxx);
+ uint3 res = (2147483648u).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.fxc.hlsl
index 99e125a..ae2987c 100644
--- a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_a6ccd4() {
- uint3 res = reversebits((1u).xxx);
+ uint3 res = (2147483648u).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.glsl
index ae14fb6..ff797a6 100644
--- a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.glsl
@@ -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 @@
precision mediump float;
void reverseBits_a6ccd4() {
- uvec3 res = bitfieldReverse(uvec3(1u));
+ uvec3 res = uvec3(2147483648u);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void reverseBits_a6ccd4() {
- uvec3 res = bitfieldReverse(uvec3(1u));
+ uvec3 res = uvec3(2147483648u);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.msl
index 1c8cfe7..ebc5d6f 100644
--- a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_a6ccd4() {
- uint3 res = reverse_bits(uint3(1u));
+ uint3 res = uint3(2147483648u);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.spvasm
index cb42d67..7be4545 100644
--- a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.spvasm
@@ -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
diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.dxc.hlsl
index 5c31987..f2aa08d 100644
--- a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_c21bc1() {
- int3 res = asint(reversebits(asuint((1).xxx)));
+ int3 res = (-2147483648).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.fxc.hlsl
index 5c31987..f2aa08d 100644
--- a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_c21bc1() {
- int3 res = asint(reversebits(asuint((1).xxx)));
+ int3 res = (-2147483648).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.glsl
index f71833d..631794a 100644
--- a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.glsl
@@ -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 @@
precision mediump float;
void reverseBits_c21bc1() {
- ivec3 res = bitfieldReverse(ivec3(1));
+ ivec3 res = ivec3(-2147483648);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void reverseBits_c21bc1() {
- ivec3 res = bitfieldReverse(ivec3(1));
+ ivec3 res = ivec3(-2147483648);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.msl
index fb2b4aa..0d687a9 100644
--- a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_c21bc1() {
- int3 res = reverse_bits(int3(1));
+ int3 res = int3((-2147483647 - 1));
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.spvasm
index 74cbb29..83d95fd 100644
--- a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.spvasm
@@ -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
diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.dxc.hlsl
index d159b1d..505d08f 100644
--- a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_e1f4c1() {
- uint2 res = reversebits((1u).xx);
+ uint2 res = (2147483648u).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.fxc.hlsl
index d159b1d..505d08f 100644
--- a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_e1f4c1() {
- uint2 res = reversebits((1u).xx);
+ uint2 res = (2147483648u).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.glsl
index 123f32c..7e40794 100644
--- a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.glsl
@@ -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 @@
precision mediump float;
void reverseBits_e1f4c1() {
- uvec2 res = bitfieldReverse(uvec2(1u));
+ uvec2 res = uvec2(2147483648u);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void reverseBits_e1f4c1() {
- uvec2 res = bitfieldReverse(uvec2(1u));
+ uvec2 res = uvec2(2147483648u);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.msl
index 0394724..7f28f03 100644
--- a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_e1f4c1() {
- uint2 res = reverse_bits(uint2(1u));
+ uint2 res = uint2(2147483648u);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.spvasm
index 9643cf0..11be15f 100644
--- a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.spvasm
@@ -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
diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.dxc.hlsl
index 823b711..bc83744 100644
--- a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_e31adf() {
- uint res = reversebits(1u);
+ uint res = 2147483648u;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.fxc.hlsl
index 823b711..bc83744 100644
--- a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void reverseBits_e31adf() {
- uint res = reversebits(1u);
+ uint res = 2147483648u;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.glsl
index 3ea3066..9702c7f 100644
--- a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void reverseBits_e31adf() {
- uint res = bitfieldReverse(1u);
+ uint res = 2147483648u;
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void reverseBits_e31adf() {
- uint res = bitfieldReverse(1u);
+ uint res = 2147483648u;
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void reverseBits_e31adf() {
- uint res = bitfieldReverse(1u);
+ uint res = 2147483648u;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.msl
index c850796..de5f9e3 100644
--- a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void reverseBits_e31adf() {
- uint res = reverse_bits(1u);
+ uint res = 2147483648u;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.spvasm
index 9f44dbe..55f8128 100644
--- a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.spvasm
@@ -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