tint: const eval of insertBits

Bug: tint:1581
Change-Id: Id89530eb90d3c75bd1f99dd67a78cad1c923c6f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107924
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano
2022-11-02 20:40:23 +00:00
committed by Dawn LUCI CQ
parent e372511e1b
commit 336f3536e5
46 changed files with 391 additions and 738 deletions

View File

@@ -1,12 +1,5 @@
uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint2((s).xx)) & uint2((mask).xx)) | (v & uint2((~(mask)).xx)));
}
void insertBits_3c7ba5() {
uint2 res = tint_insert_bits((1u).xx, (1u).xx, 1u, 1u);
uint2 res = (3u).xx;
}
struct tint_symbol {

View File

@@ -1,12 +1,5 @@
uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint2((s).xx)) & uint2((mask).xx)) | (v & uint2((~(mask)).xx)));
}
void insertBits_3c7ba5() {
uint2 res = tint_insert_bits((1u).xx, (1u).xx, 1u, 1u);
uint2 res = (3u).xx;
}
struct tint_symbol {

View File

@@ -1,13 +1,7 @@
#version 310 es
uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_3c7ba5() {
uvec2 res = tint_insert_bits(uvec2(1u), uvec2(1u), 1u, 1u);
uvec2 res = uvec2(3u);
}
vec4 vertex_main() {
@@ -26,14 +20,8 @@ void main() {
#version 310 es
precision mediump float;
uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_3c7ba5() {
uvec2 res = tint_insert_bits(uvec2(1u), uvec2(1u), 1u, 1u);
uvec2 res = uvec2(3u);
}
void fragment_main() {
@@ -46,14 +34,8 @@ void main() {
}
#version 310 es
uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_3c7ba5() {
uvec2 res = tint_insert_bits(uvec2(1u), uvec2(1u), 1u, 1u);
uvec2 res = uvec2(3u);
}
void compute_main() {

View File

@@ -1,14 +1,8 @@
#include <metal_stdlib>
using namespace metal;
uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) {
uint const s = min(offset, 32u);
uint const e = min(32u, (s + count));
return insert_bits(v, n, s, (e - s));
}
void insertBits_3c7ba5() {
uint2 res = tint_insert_bits(uint2(1u), uint2(1u), 1u, 1u);
uint2 res = uint2(3u);
}
struct tint_symbol {

View File

@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 49
; Bound: 34
; Schema: 0
OpCapability Shader
%19 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -13,11 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %tint_insert_bits "tint_insert_bits"
OpName %v "v"
OpName %n "n"
OpName %offset "offset"
OpName %count "count"
OpName %insertBits_3c7ba5 "insertBits_3c7ba5"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
@@ -34,57 +28,41 @@
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
%9 = OpTypeFunction %v2uint %v2uint %v2uint %uint %uint
%uint_32 = OpConstant %uint 32
%void = OpTypeVoid
%25 = OpTypeFunction %void
%uint_1 = OpConstant %uint 1
%31 = OpConstantComposite %v2uint %uint_1 %uint_1
%uint_3 = OpConstant %uint 3
%16 = OpConstantComposite %v2uint %uint_3 %uint_3
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
%34 = OpConstantNull %v2uint
%35 = OpTypeFunction %v4float
%19 = OpConstantNull %v2uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%tint_insert_bits = OpFunction %v2uint None %9
%v = OpFunctionParameter %v2uint
%n = OpFunctionParameter %v2uint
%offset = OpFunctionParameter %uint
%count = OpFunctionParameter %uint
%17 = OpLabel
%18 = OpExtInst %uint %19 UMin %offset %uint_32
%22 = OpIAdd %uint %18 %count
%21 = OpExtInst %uint %19 UMin %uint_32 %22
%24 = OpISub %uint %21 %18
%23 = OpBitFieldInsert %v2uint %v %n %18 %24
OpReturnValue %23
OpFunctionEnd
%insertBits_3c7ba5 = OpFunction %void None %25
%28 = OpLabel
%res = OpVariable %_ptr_Function_v2uint Function %34
%29 = OpFunctionCall %v2uint %tint_insert_bits %31 %31 %uint_1 %uint_1
OpStore %res %29
%insertBits_3c7ba5 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2uint Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %35
%37 = OpLabel
%38 = OpFunctionCall %void %insertBits_3c7ba5
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %insertBits_3c7ba5
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %25
%40 = OpLabel
%41 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %41
%vertex_main = OpFunction %void None %9
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %25
%44 = OpLabel
%45 = OpFunctionCall %void %insertBits_3c7ba5
%fragment_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %insertBits_3c7ba5
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %25
%47 = OpLabel
%48 = OpFunctionCall %void %insertBits_3c7ba5
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %insertBits_3c7ba5
OpReturn
OpFunctionEnd

View File

@@ -1,12 +1,5 @@
int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx)));
}
void insertBits_428b0b() {
int3 res = tint_insert_bits((1).xxx, (1).xxx, 1u, 1u);
int3 res = (3).xxx;
}
struct tint_symbol {

View File

@@ -1,12 +1,5 @@
int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx)));
}
void insertBits_428b0b() {
int3 res = tint_insert_bits((1).xxx, (1).xxx, 1u, 1u);
int3 res = (3).xxx;
}
struct tint_symbol {

View File

@@ -1,13 +1,7 @@
#version 310 es
ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_428b0b() {
ivec3 res = tint_insert_bits(ivec3(1), ivec3(1), 1u, 1u);
ivec3 res = ivec3(3);
}
vec4 vertex_main() {
@@ -26,14 +20,8 @@ void main() {
#version 310 es
precision mediump float;
ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_428b0b() {
ivec3 res = tint_insert_bits(ivec3(1), ivec3(1), 1u, 1u);
ivec3 res = ivec3(3);
}
void fragment_main() {
@@ -46,14 +34,8 @@ void main() {
}
#version 310 es
ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_428b0b() {
ivec3 res = tint_insert_bits(ivec3(1), ivec3(1), 1u, 1u);
ivec3 res = ivec3(3);
}
void compute_main() {

View File

@@ -1,14 +1,8 @@
#include <metal_stdlib>
using namespace metal;
int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) {
uint const s = min(offset, 32u);
uint const e = min(32u, (s + count));
return insert_bits(v, n, s, (e - s));
}
void insertBits_428b0b() {
int3 res = tint_insert_bits(int3(1), int3(1), 1u, 1u);
int3 res = int3(3);
}
struct tint_symbol {

View File

@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 51
; Bound: 34
; Schema: 0
OpCapability Shader
%20 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -13,11 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %tint_insert_bits "tint_insert_bits"
OpName %v "v"
OpName %n "n"
OpName %offset "offset"
OpName %count "count"
OpName %insertBits_428b0b "insertBits_428b0b"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
@@ -34,59 +28,41 @@
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%uint = OpTypeInt 32 0
%9 = OpTypeFunction %v3int %v3int %v3int %uint %uint
%uint_32 = OpConstant %uint 32
%void = OpTypeVoid
%26 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%32 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%uint_1 = OpConstant %uint 1
%int_3 = OpConstant %int 3
%16 = OpConstantComposite %v3int %int_3 %int_3 %int_3
%_ptr_Function_v3int = OpTypePointer Function %v3int
%36 = OpConstantNull %v3int
%37 = OpTypeFunction %v4float
%19 = OpConstantNull %v3int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%tint_insert_bits = OpFunction %v3int None %9
%v = OpFunctionParameter %v3int
%n = OpFunctionParameter %v3int
%offset = OpFunctionParameter %uint
%count = OpFunctionParameter %uint
%18 = OpLabel
%19 = OpExtInst %uint %20 UMin %offset %uint_32
%23 = OpIAdd %uint %19 %count
%22 = OpExtInst %uint %20 UMin %uint_32 %23
%25 = OpISub %uint %22 %19
%24 = OpBitFieldInsert %v3int %v %n %19 %25
OpReturnValue %24
OpFunctionEnd
%insertBits_428b0b = OpFunction %void None %26
%29 = OpLabel
%res = OpVariable %_ptr_Function_v3int Function %36
%30 = OpFunctionCall %v3int %tint_insert_bits %32 %32 %uint_1 %uint_1
OpStore %res %30
%insertBits_428b0b = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %37
%39 = OpLabel
%40 = OpFunctionCall %void %insertBits_428b0b
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %insertBits_428b0b
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %26
%42 = OpLabel
%43 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %43
%vertex_main = OpFunction %void None %9
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %26
%46 = OpLabel
%47 = OpFunctionCall %void %insertBits_428b0b
%fragment_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %insertBits_428b0b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %26
%49 = OpLabel
%50 = OpFunctionCall %void %insertBits_428b0b
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %insertBits_428b0b
OpReturn
OpFunctionEnd

View File

@@ -1,12 +1,5 @@
uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint4((s).xxxx)) & uint4((mask).xxxx)) | (v & uint4((~(mask)).xxxx)));
}
void insertBits_51ede1() {
uint4 res = tint_insert_bits((1u).xxxx, (1u).xxxx, 1u, 1u);
uint4 res = (3u).xxxx;
}
struct tint_symbol {

View File

@@ -1,12 +1,5 @@
uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint4((s).xxxx)) & uint4((mask).xxxx)) | (v & uint4((~(mask)).xxxx)));
}
void insertBits_51ede1() {
uint4 res = tint_insert_bits((1u).xxxx, (1u).xxxx, 1u, 1u);
uint4 res = (3u).xxxx;
}
struct tint_symbol {

View File

@@ -1,13 +1,7 @@
#version 310 es
uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_51ede1() {
uvec4 res = tint_insert_bits(uvec4(1u), uvec4(1u), 1u, 1u);
uvec4 res = uvec4(3u);
}
vec4 vertex_main() {
@@ -26,14 +20,8 @@ void main() {
#version 310 es
precision mediump float;
uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_51ede1() {
uvec4 res = tint_insert_bits(uvec4(1u), uvec4(1u), 1u, 1u);
uvec4 res = uvec4(3u);
}
void fragment_main() {
@@ -46,14 +34,8 @@ void main() {
}
#version 310 es
uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_51ede1() {
uvec4 res = tint_insert_bits(uvec4(1u), uvec4(1u), 1u, 1u);
uvec4 res = uvec4(3u);
}
void compute_main() {

View File

@@ -1,14 +1,8 @@
#include <metal_stdlib>
using namespace metal;
uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) {
uint const s = min(offset, 32u);
uint const e = min(32u, (s + count));
return insert_bits(v, n, s, (e - s));
}
void insertBits_51ede1() {
uint4 res = tint_insert_bits(uint4(1u), uint4(1u), 1u, 1u);
uint4 res = uint4(3u);
}
struct tint_symbol {

View File

@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 49
; Bound: 34
; Schema: 0
OpCapability Shader
%19 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -13,11 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %tint_insert_bits "tint_insert_bits"
OpName %v "v"
OpName %n "n"
OpName %offset "offset"
OpName %count "count"
OpName %insertBits_51ede1 "insertBits_51ede1"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
@@ -34,57 +28,41 @@
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4
%9 = OpTypeFunction %v4uint %v4uint %v4uint %uint %uint
%uint_32 = OpConstant %uint 32
%void = OpTypeVoid
%25 = OpTypeFunction %void
%uint_1 = OpConstant %uint 1
%31 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
%uint_3 = OpConstant %uint 3
%16 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
%34 = OpConstantNull %v4uint
%35 = OpTypeFunction %v4float
%19 = OpConstantNull %v4uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%tint_insert_bits = OpFunction %v4uint None %9
%v = OpFunctionParameter %v4uint
%n = OpFunctionParameter %v4uint
%offset = OpFunctionParameter %uint
%count = OpFunctionParameter %uint
%17 = OpLabel
%18 = OpExtInst %uint %19 UMin %offset %uint_32
%22 = OpIAdd %uint %18 %count
%21 = OpExtInst %uint %19 UMin %uint_32 %22
%24 = OpISub %uint %21 %18
%23 = OpBitFieldInsert %v4uint %v %n %18 %24
OpReturnValue %23
OpFunctionEnd
%insertBits_51ede1 = OpFunction %void None %25
%28 = OpLabel
%res = OpVariable %_ptr_Function_v4uint Function %34
%29 = OpFunctionCall %v4uint %tint_insert_bits %31 %31 %uint_1 %uint_1
OpStore %res %29
%insertBits_51ede1 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4uint Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %35
%37 = OpLabel
%38 = OpFunctionCall %void %insertBits_51ede1
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %insertBits_51ede1
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %25
%40 = OpLabel
%41 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %41
%vertex_main = OpFunction %void None %9
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %25
%44 = OpLabel
%45 = OpFunctionCall %void %insertBits_51ede1
%fragment_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %insertBits_51ede1
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %25
%47 = OpLabel
%48 = OpFunctionCall %void %insertBits_51ede1
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %insertBits_51ede1
OpReturn
OpFunctionEnd

View File

@@ -1,12 +1,5 @@
int tint_insert_bits(int v, int n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << s) & int(mask)) | (v & int(~(mask))));
}
void insertBits_65468b() {
int res = tint_insert_bits(1, 1, 1u, 1u);
int res = 3;
}
struct tint_symbol {

View File

@@ -1,12 +1,5 @@
int tint_insert_bits(int v, int n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << s) & int(mask)) | (v & int(~(mask))));
}
void insertBits_65468b() {
int res = tint_insert_bits(1, 1, 1u, 1u);
int res = 3;
}
struct tint_symbol {

View File

@@ -1,13 +1,7 @@
#version 310 es
int tint_insert_bits(int v, int n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_65468b() {
int res = tint_insert_bits(1, 1, 1u, 1u);
int res = 3;
}
vec4 vertex_main() {
@@ -26,14 +20,8 @@ void main() {
#version 310 es
precision mediump float;
int tint_insert_bits(int v, int n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_65468b() {
int res = tint_insert_bits(1, 1, 1u, 1u);
int res = 3;
}
void fragment_main() {
@@ -46,14 +34,8 @@ void main() {
}
#version 310 es
int tint_insert_bits(int v, int n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_65468b() {
int res = tint_insert_bits(1, 1, 1u, 1u);
int res = 3;
}
void compute_main() {

View File

@@ -1,14 +1,8 @@
#include <metal_stdlib>
using namespace metal;
int tint_insert_bits(int v, int n, uint offset, uint count) {
uint const s = min(offset, 32u);
uint const e = min(32u, (s + count));
return insert_bits(v, n, s, (e - s));
}
void insertBits_65468b() {
int res = tint_insert_bits(1, 1, 1u, 1u);
int res = 3;
}
struct tint_symbol {

View File

@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 49
; Bound: 32
; Schema: 0
OpCapability Shader
%19 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -13,11 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %tint_insert_bits "tint_insert_bits"
OpName %v "v"
OpName %n "n"
OpName %offset "offset"
OpName %count "count"
OpName %insertBits_65468b "insertBits_65468b"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
@@ -34,57 +28,39 @@
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%9 = OpTypeFunction %int %int %int %uint %uint
%uint_32 = OpConstant %uint 32
%void = OpTypeVoid
%25 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%uint_1 = OpConstant %uint 1
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_3 = OpConstant %int 3
%_ptr_Function_int = OpTypePointer Function %int
%34 = OpConstantNull %int
%35 = OpTypeFunction %v4float
%17 = OpConstantNull %int
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%tint_insert_bits = OpFunction %int None %9
%v = OpFunctionParameter %int
%n = OpFunctionParameter %int
%offset = OpFunctionParameter %uint
%count = OpFunctionParameter %uint
%17 = OpLabel
%18 = OpExtInst %uint %19 UMin %offset %uint_32
%22 = OpIAdd %uint %18 %count
%21 = OpExtInst %uint %19 UMin %uint_32 %22
%24 = OpISub %uint %21 %18
%23 = OpBitFieldInsert %int %v %n %18 %24
OpReturnValue %23
OpFunctionEnd
%insertBits_65468b = OpFunction %void None %25
%28 = OpLabel
%res = OpVariable %_ptr_Function_int Function %34
%29 = OpFunctionCall %int %tint_insert_bits %int_1 %int_1 %uint_1 %uint_1
OpStore %res %29
%insertBits_65468b = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_int Function %17
OpStore %res %int_3
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %35
%37 = OpLabel
%38 = OpFunctionCall %void %insertBits_65468b
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %insertBits_65468b
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %25
%40 = OpLabel
%41 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %41
%vertex_main = OpFunction %void None %9
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %25
%44 = OpLabel
%45 = OpFunctionCall %void %insertBits_65468b
%fragment_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %insertBits_65468b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %25
%47 = OpLabel
%48 = OpFunctionCall %void %insertBits_65468b
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %insertBits_65468b
OpReturn
OpFunctionEnd

View File

@@ -1,12 +1,5 @@
uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx)));
}
void insertBits_87826b() {
uint3 res = tint_insert_bits((1u).xxx, (1u).xxx, 1u, 1u);
uint3 res = (3u).xxx;
}
struct tint_symbol {

View File

@@ -1,12 +1,5 @@
uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx)));
}
void insertBits_87826b() {
uint3 res = tint_insert_bits((1u).xxx, (1u).xxx, 1u, 1u);
uint3 res = (3u).xxx;
}
struct tint_symbol {

View File

@@ -1,13 +1,7 @@
#version 310 es
uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_87826b() {
uvec3 res = tint_insert_bits(uvec3(1u), uvec3(1u), 1u, 1u);
uvec3 res = uvec3(3u);
}
vec4 vertex_main() {
@@ -26,14 +20,8 @@ void main() {
#version 310 es
precision mediump float;
uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_87826b() {
uvec3 res = tint_insert_bits(uvec3(1u), uvec3(1u), 1u, 1u);
uvec3 res = uvec3(3u);
}
void fragment_main() {
@@ -46,14 +34,8 @@ void main() {
}
#version 310 es
uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_87826b() {
uvec3 res = tint_insert_bits(uvec3(1u), uvec3(1u), 1u, 1u);
uvec3 res = uvec3(3u);
}
void compute_main() {

View File

@@ -1,14 +1,8 @@
#include <metal_stdlib>
using namespace metal;
uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) {
uint const s = min(offset, 32u);
uint const e = min(32u, (s + count));
return insert_bits(v, n, s, (e - s));
}
void insertBits_87826b() {
uint3 res = tint_insert_bits(uint3(1u), uint3(1u), 1u, 1u);
uint3 res = uint3(3u);
}
struct tint_symbol {

View File

@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 49
; Bound: 34
; Schema: 0
OpCapability Shader
%19 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -13,11 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %tint_insert_bits "tint_insert_bits"
OpName %v "v"
OpName %n "n"
OpName %offset "offset"
OpName %count "count"
OpName %insertBits_87826b "insertBits_87826b"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
@@ -34,57 +28,41 @@
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%9 = OpTypeFunction %v3uint %v3uint %v3uint %uint %uint
%uint_32 = OpConstant %uint 32
%void = OpTypeVoid
%25 = OpTypeFunction %void
%uint_1 = OpConstant %uint 1
%31 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%uint_3 = OpConstant %uint 3
%16 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%34 = OpConstantNull %v3uint
%35 = OpTypeFunction %v4float
%19 = OpConstantNull %v3uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%tint_insert_bits = OpFunction %v3uint None %9
%v = OpFunctionParameter %v3uint
%n = OpFunctionParameter %v3uint
%offset = OpFunctionParameter %uint
%count = OpFunctionParameter %uint
%17 = OpLabel
%18 = OpExtInst %uint %19 UMin %offset %uint_32
%22 = OpIAdd %uint %18 %count
%21 = OpExtInst %uint %19 UMin %uint_32 %22
%24 = OpISub %uint %21 %18
%23 = OpBitFieldInsert %v3uint %v %n %18 %24
OpReturnValue %23
OpFunctionEnd
%insertBits_87826b = OpFunction %void None %25
%28 = OpLabel
%res = OpVariable %_ptr_Function_v3uint Function %34
%29 = OpFunctionCall %v3uint %tint_insert_bits %31 %31 %uint_1 %uint_1
OpStore %res %29
%insertBits_87826b = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3uint Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %35
%37 = OpLabel
%38 = OpFunctionCall %void %insertBits_87826b
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %insertBits_87826b
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %25
%40 = OpLabel
%41 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %41
%vertex_main = OpFunction %void None %9
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %25
%44 = OpLabel
%45 = OpFunctionCall %void %insertBits_87826b
%fragment_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %insertBits_87826b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %25
%47 = OpLabel
%48 = OpFunctionCall %void %insertBits_87826b
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %insertBits_87826b
OpReturn
OpFunctionEnd

View File

@@ -1,12 +1,5 @@
int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint4((s).xxxx)) & int4((int(mask)).xxxx)) | (v & int4((int(~(mask))).xxxx)));
}
void insertBits_d86978() {
int4 res = tint_insert_bits((1).xxxx, (1).xxxx, 1u, 1u);
int4 res = (3).xxxx;
}
struct tint_symbol {

View File

@@ -1,12 +1,5 @@
int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint4((s).xxxx)) & int4((int(mask)).xxxx)) | (v & int4((int(~(mask))).xxxx)));
}
void insertBits_d86978() {
int4 res = tint_insert_bits((1).xxxx, (1).xxxx, 1u, 1u);
int4 res = (3).xxxx;
}
struct tint_symbol {

View File

@@ -1,13 +1,7 @@
#version 310 es
ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_d86978() {
ivec4 res = tint_insert_bits(ivec4(1), ivec4(1), 1u, 1u);
ivec4 res = ivec4(3);
}
vec4 vertex_main() {
@@ -26,14 +20,8 @@ void main() {
#version 310 es
precision mediump float;
ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_d86978() {
ivec4 res = tint_insert_bits(ivec4(1), ivec4(1), 1u, 1u);
ivec4 res = ivec4(3);
}
void fragment_main() {
@@ -46,14 +34,8 @@ void main() {
}
#version 310 es
ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_d86978() {
ivec4 res = tint_insert_bits(ivec4(1), ivec4(1), 1u, 1u);
ivec4 res = ivec4(3);
}
void compute_main() {

View File

@@ -1,14 +1,8 @@
#include <metal_stdlib>
using namespace metal;
int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) {
uint const s = min(offset, 32u);
uint const e = min(32u, (s + count));
return insert_bits(v, n, s, (e - s));
}
void insertBits_d86978() {
int4 res = tint_insert_bits(int4(1), int4(1), 1u, 1u);
int4 res = int4(3);
}
struct tint_symbol {

View File

@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 51
; Bound: 34
; Schema: 0
OpCapability Shader
%20 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -13,11 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %tint_insert_bits "tint_insert_bits"
OpName %v "v"
OpName %n "n"
OpName %offset "offset"
OpName %count "count"
OpName %insertBits_d86978 "insertBits_d86978"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
@@ -34,59 +28,41 @@
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4
%uint = OpTypeInt 32 0
%9 = OpTypeFunction %v4int %v4int %v4int %uint %uint
%uint_32 = OpConstant %uint 32
%void = OpTypeVoid
%26 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%32 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%uint_1 = OpConstant %uint 1
%int_3 = OpConstant %int 3
%16 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
%_ptr_Function_v4int = OpTypePointer Function %v4int
%36 = OpConstantNull %v4int
%37 = OpTypeFunction %v4float
%19 = OpConstantNull %v4int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%tint_insert_bits = OpFunction %v4int None %9
%v = OpFunctionParameter %v4int
%n = OpFunctionParameter %v4int
%offset = OpFunctionParameter %uint
%count = OpFunctionParameter %uint
%18 = OpLabel
%19 = OpExtInst %uint %20 UMin %offset %uint_32
%23 = OpIAdd %uint %19 %count
%22 = OpExtInst %uint %20 UMin %uint_32 %23
%25 = OpISub %uint %22 %19
%24 = OpBitFieldInsert %v4int %v %n %19 %25
OpReturnValue %24
OpFunctionEnd
%insertBits_d86978 = OpFunction %void None %26
%29 = OpLabel
%res = OpVariable %_ptr_Function_v4int Function %36
%30 = OpFunctionCall %v4int %tint_insert_bits %32 %32 %uint_1 %uint_1
OpStore %res %30
%insertBits_d86978 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %37
%39 = OpLabel
%40 = OpFunctionCall %void %insertBits_d86978
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %insertBits_d86978
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %26
%42 = OpLabel
%43 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %43
%vertex_main = OpFunction %void None %9
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %26
%46 = OpLabel
%47 = OpFunctionCall %void %insertBits_d86978
%fragment_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %insertBits_d86978
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %26
%49 = OpLabel
%50 = OpFunctionCall %void %insertBits_d86978
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %insertBits_d86978
OpReturn
OpFunctionEnd

View File

@@ -1,12 +1,5 @@
uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << s) & mask) | (v & ~(mask)));
}
void insertBits_e3e3a2() {
uint res = tint_insert_bits(1u, 1u, 1u, 1u);
uint res = 3u;
}
struct tint_symbol {

View File

@@ -1,12 +1,5 @@
uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << s) & mask) | (v & ~(mask)));
}
void insertBits_e3e3a2() {
uint res = tint_insert_bits(1u, 1u, 1u, 1u);
uint res = 3u;
}
struct tint_symbol {

View File

@@ -1,13 +1,7 @@
#version 310 es
uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_e3e3a2() {
uint res = tint_insert_bits(1u, 1u, 1u, 1u);
uint res = 3u;
}
vec4 vertex_main() {
@@ -26,14 +20,8 @@ void main() {
#version 310 es
precision mediump float;
uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_e3e3a2() {
uint res = tint_insert_bits(1u, 1u, 1u, 1u);
uint res = 3u;
}
void fragment_main() {
@@ -46,14 +34,8 @@ void main() {
}
#version 310 es
uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_e3e3a2() {
uint res = tint_insert_bits(1u, 1u, 1u, 1u);
uint res = 3u;
}
void compute_main() {

View File

@@ -1,14 +1,8 @@
#include <metal_stdlib>
using namespace metal;
uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
uint const s = min(offset, 32u);
uint const e = min(32u, (s + count));
return insert_bits(v, n, s, (e - s));
}
void insertBits_e3e3a2() {
uint res = tint_insert_bits(1u, 1u, 1u, 1u);
uint res = 3u;
}
struct tint_symbol {

View File

@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 47
; Bound: 32
; Schema: 0
OpCapability Shader
%18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -13,11 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %tint_insert_bits "tint_insert_bits"
OpName %v "v"
OpName %n "n"
OpName %offset "offset"
OpName %count "count"
OpName %insertBits_e3e3a2 "insertBits_e3e3a2"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
@@ -34,55 +28,39 @@
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%uint = OpTypeInt 32 0
%9 = OpTypeFunction %uint %uint %uint %uint %uint
%uint_32 = OpConstant %uint 32
%void = OpTypeVoid
%24 = OpTypeFunction %void
%uint_1 = OpConstant %uint 1
%9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_3 = OpConstant %uint 3
%_ptr_Function_uint = OpTypePointer Function %uint
%32 = OpConstantNull %uint
%33 = OpTypeFunction %v4float
%17 = OpConstantNull %uint
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%tint_insert_bits = OpFunction %uint None %9
%v = OpFunctionParameter %uint
%n = OpFunctionParameter %uint
%offset = OpFunctionParameter %uint
%count = OpFunctionParameter %uint
%16 = OpLabel
%17 = OpExtInst %uint %18 UMin %offset %uint_32
%21 = OpIAdd %uint %17 %count
%20 = OpExtInst %uint %18 UMin %uint_32 %21
%23 = OpISub %uint %20 %17
%22 = OpBitFieldInsert %uint %v %n %17 %23
OpReturnValue %22
OpFunctionEnd
%insertBits_e3e3a2 = OpFunction %void None %24
%27 = OpLabel
%res = OpVariable %_ptr_Function_uint Function %32
%28 = OpFunctionCall %uint %tint_insert_bits %uint_1 %uint_1 %uint_1 %uint_1
OpStore %res %28
%insertBits_e3e3a2 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_uint Function %17
OpStore %res %uint_3
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %33
%35 = OpLabel
%36 = OpFunctionCall %void %insertBits_e3e3a2
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %insertBits_e3e3a2
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %24
%38 = OpLabel
%39 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %39
%vertex_main = OpFunction %void None %9
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %24
%42 = OpLabel
%43 = OpFunctionCall %void %insertBits_e3e3a2
%fragment_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %insertBits_e3e3a2
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %24
%45 = OpLabel
%46 = OpFunctionCall %void %insertBits_e3e3a2
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %insertBits_e3e3a2
OpReturn
OpFunctionEnd

View File

@@ -1,12 +1,5 @@
int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint2((s).xx)) & int2((int(mask)).xx)) | (v & int2((int(~(mask))).xx)));
}
void insertBits_fe6ba6() {
int2 res = tint_insert_bits((1).xx, (1).xx, 1u, 1u);
int2 res = (3).xx;
}
struct tint_symbol {

View File

@@ -1,12 +1,5 @@
int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) {
const uint s = min(offset, 32u);
const uint e = min(32u, (s + count));
const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
return (((n << uint2((s).xx)) & int2((int(mask)).xx)) | (v & int2((int(~(mask))).xx)));
}
void insertBits_fe6ba6() {
int2 res = tint_insert_bits((1).xx, (1).xx, 1u, 1u);
int2 res = (3).xx;
}
struct tint_symbol {

View File

@@ -1,13 +1,7 @@
#version 310 es
ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_fe6ba6() {
ivec2 res = tint_insert_bits(ivec2(1), ivec2(1), 1u, 1u);
ivec2 res = ivec2(3);
}
vec4 vertex_main() {
@@ -26,14 +20,8 @@ void main() {
#version 310 es
precision mediump float;
ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_fe6ba6() {
ivec2 res = tint_insert_bits(ivec2(1), ivec2(1), 1u, 1u);
ivec2 res = ivec2(3);
}
void fragment_main() {
@@ -46,14 +34,8 @@ void main() {
}
#version 310 es
ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) {
uint s = min(offset, 32u);
uint e = min(32u, (s + count));
return bitfieldInsert(v, n, int(s), int((e - s)));
}
void insertBits_fe6ba6() {
ivec2 res = tint_insert_bits(ivec2(1), ivec2(1), 1u, 1u);
ivec2 res = ivec2(3);
}
void compute_main() {

View File

@@ -1,14 +1,8 @@
#include <metal_stdlib>
using namespace metal;
int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) {
uint const s = min(offset, 32u);
uint const e = min(32u, (s + count));
return insert_bits(v, n, s, (e - s));
}
void insertBits_fe6ba6() {
int2 res = tint_insert_bits(int2(1), int2(1), 1u, 1u);
int2 res = int2(3);
}
struct tint_symbol {

View File

@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 51
; Bound: 34
; Schema: 0
OpCapability Shader
%20 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -13,11 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %tint_insert_bits "tint_insert_bits"
OpName %v "v"
OpName %n "n"
OpName %offset "offset"
OpName %count "count"
OpName %insertBits_fe6ba6 "insertBits_fe6ba6"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
@@ -34,59 +28,41 @@
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%uint = OpTypeInt 32 0
%9 = OpTypeFunction %v2int %v2int %v2int %uint %uint
%uint_32 = OpConstant %uint 32
%void = OpTypeVoid
%26 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%32 = OpConstantComposite %v2int %int_1 %int_1
%uint_1 = OpConstant %uint 1
%int_3 = OpConstant %int 3
%16 = OpConstantComposite %v2int %int_3 %int_3
%_ptr_Function_v2int = OpTypePointer Function %v2int
%36 = OpConstantNull %v2int
%37 = OpTypeFunction %v4float
%19 = OpConstantNull %v2int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%tint_insert_bits = OpFunction %v2int None %9
%v = OpFunctionParameter %v2int
%n = OpFunctionParameter %v2int
%offset = OpFunctionParameter %uint
%count = OpFunctionParameter %uint
%18 = OpLabel
%19 = OpExtInst %uint %20 UMin %offset %uint_32
%23 = OpIAdd %uint %19 %count
%22 = OpExtInst %uint %20 UMin %uint_32 %23
%25 = OpISub %uint %22 %19
%24 = OpBitFieldInsert %v2int %v %n %19 %25
OpReturnValue %24
OpFunctionEnd
%insertBits_fe6ba6 = OpFunction %void None %26
%29 = OpLabel
%res = OpVariable %_ptr_Function_v2int Function %36
%30 = OpFunctionCall %v2int %tint_insert_bits %32 %32 %uint_1 %uint_1
OpStore %res %30
%insertBits_fe6ba6 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %37
%39 = OpLabel
%40 = OpFunctionCall %void %insertBits_fe6ba6
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %insertBits_fe6ba6
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %26
%42 = OpLabel
%43 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %43
%vertex_main = OpFunction %void None %9
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %26
%46 = OpLabel
%47 = OpFunctionCall %void %insertBits_fe6ba6
%fragment_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %insertBits_fe6ba6
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %26
%49 = OpLabel
%50 = OpFunctionCall %void %insertBits_fe6ba6
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %insertBits_fe6ba6
OpReturn
OpFunctionEnd