Add const-eval for all.

This CL adds const-eval for the `all` builtin.

Bug: tint:1581
Change-Id: Ib1d857ba24114c61e1a90b30dd66d063edfa136d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107464
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair
2022-11-03 12:07:49 +00:00
committed by Dawn LUCI CQ
parent aa4b64f4c8
commit 58eca19f33
24 changed files with 131 additions and 96 deletions

View File

@@ -1,5 +1,5 @@
void all_353d6a() {
bool res = all(true);
bool res = true;
}
struct tint_symbol {

View File

@@ -1,5 +1,5 @@
void all_353d6a() {
bool res = all(true);
bool res = true;
}
struct tint_symbol {

View File

@@ -2,7 +2,7 @@
using namespace metal;
void all_353d6a() {
bool res = all(true);
bool res = true;
}
struct tint_symbol {

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 33
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -33,34 +33,34 @@
%bool = OpTypeBool
%true = OpConstantTrue %bool
%_ptr_Function_bool = OpTypePointer Function %bool
%18 = OpConstantNull %bool
%19 = OpTypeFunction %v4float
%17 = OpConstantNull %bool
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%all_353d6a = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_bool Function %18
%res = OpVariable %_ptr_Function_bool Function %17
OpStore %res %true
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %all_353d6a
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %all_353d6a
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 %all_353d6a
%27 = OpLabel
%28 = OpFunctionCall %void %all_353d6a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%31 = OpLabel
%32 = OpFunctionCall %void %all_353d6a
%30 = OpLabel
%31 = OpFunctionCall %void %all_353d6a
OpReturn
OpFunctionEnd

View File

@@ -1,5 +1,5 @@
void all_986c7b() {
bool res = all((true).xxxx);
bool res = true;
}
struct tint_symbol {

View File

@@ -1,5 +1,5 @@
void all_986c7b() {
bool res = all((true).xxxx);
bool res = true;
}
struct tint_symbol {

View File

@@ -1,7 +1,7 @@
#version 310 es
void all_986c7b() {
bool res = all(bvec4(true));
bool res = true;
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@ void main() {
precision mediump float;
void all_986c7b() {
bool res = all(bvec4(true));
bool res = true;
}
void fragment_main() {
@@ -35,7 +35,7 @@ void main() {
#version 310 es
void all_986c7b() {
bool res = all(bvec4(true));
bool res = true;
}
void compute_main() {

View File

@@ -2,7 +2,7 @@
using namespace metal;
void all_986c7b() {
bool res = all(bool4(true));
bool res = true;
}
struct tint_symbol {

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 35
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -31,39 +31,36 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%bool = OpTypeBool
%v4bool = OpTypeVector %bool 4
%true = OpConstantTrue %bool
%17 = OpConstantComposite %v4bool %true %true %true %true
%_ptr_Function_bool = OpTypePointer Function %bool
%20 = OpConstantNull %bool
%21 = OpTypeFunction %v4float
%17 = OpConstantNull %bool
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%all_986c7b = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_bool Function %20
%13 = OpAll %bool %17
OpStore %res %13
%res = OpVariable %_ptr_Function_bool Function %17
OpStore %res %true
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %all_986c7b
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %all_986c7b
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%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
%27 = OpLabel
%28 = OpFunctionCall %void %all_986c7b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %all_986c7b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %all_986c7b
OpReturn
OpFunctionEnd

View File

@@ -1,5 +1,5 @@
void all_bd2dba() {
bool res = all((true).xxx);
bool res = true;
}
struct tint_symbol {

View File

@@ -1,5 +1,5 @@
void all_bd2dba() {
bool res = all((true).xxx);
bool res = true;
}
struct tint_symbol {

View File

@@ -1,7 +1,7 @@
#version 310 es
void all_bd2dba() {
bool res = all(bvec3(true));
bool res = true;
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@ void main() {
precision mediump float;
void all_bd2dba() {
bool res = all(bvec3(true));
bool res = true;
}
void fragment_main() {
@@ -35,7 +35,7 @@ void main() {
#version 310 es
void all_bd2dba() {
bool res = all(bvec3(true));
bool res = true;
}
void compute_main() {

View File

@@ -2,7 +2,7 @@
using namespace metal;
void all_bd2dba() {
bool res = all(bool3(true));
bool res = true;
}
struct tint_symbol {

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 35
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -31,39 +31,36 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%bool = OpTypeBool
%v3bool = OpTypeVector %bool 3
%true = OpConstantTrue %bool
%17 = OpConstantComposite %v3bool %true %true %true
%_ptr_Function_bool = OpTypePointer Function %bool
%20 = OpConstantNull %bool
%21 = OpTypeFunction %v4float
%17 = OpConstantNull %bool
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%all_bd2dba = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_bool Function %20
%13 = OpAll %bool %17
OpStore %res %13
%res = OpVariable %_ptr_Function_bool Function %17
OpStore %res %true
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %all_bd2dba
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %all_bd2dba
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%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
%27 = OpLabel
%28 = OpFunctionCall %void %all_bd2dba
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %all_bd2dba
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %all_bd2dba
OpReturn
OpFunctionEnd

View File

@@ -1,5 +1,5 @@
void all_f46790() {
bool res = all((true).xx);
bool res = true;
}
struct tint_symbol {

View File

@@ -1,5 +1,5 @@
void all_f46790() {
bool res = all((true).xx);
bool res = true;
}
struct tint_symbol {

View File

@@ -1,7 +1,7 @@
#version 310 es
void all_f46790() {
bool res = all(bvec2(true));
bool res = true;
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@ void main() {
precision mediump float;
void all_f46790() {
bool res = all(bvec2(true));
bool res = true;
}
void fragment_main() {
@@ -35,7 +35,7 @@ void main() {
#version 310 es
void all_f46790() {
bool res = all(bvec2(true));
bool res = true;
}
void compute_main() {

View File

@@ -2,7 +2,7 @@
using namespace metal;
void all_f46790() {
bool res = all(bool2(true));
bool res = true;
}
struct tint_symbol {

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 35
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -31,39 +31,36 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%bool = OpTypeBool
%v2bool = OpTypeVector %bool 2
%true = OpConstantTrue %bool
%17 = OpConstantComposite %v2bool %true %true
%_ptr_Function_bool = OpTypePointer Function %bool
%20 = OpConstantNull %bool
%21 = OpTypeFunction %v4float
%17 = OpConstantNull %bool
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%all_f46790 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_bool Function %20
%13 = OpAll %bool %17
OpStore %res %13
%res = OpVariable %_ptr_Function_bool Function %17
OpStore %res %true
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %all_f46790
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %all_f46790
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%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
%27 = OpLabel
%28 = OpFunctionCall %void %all_f46790
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %all_f46790
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %all_f46790
OpReturn
OpFunctionEnd