tint: const eval of binary bitwise AND and OR

Bug: tint:1581
Change-Id: Id6a7a1c8e45ee91bede8014dca03a59035b29678
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102060
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano
2022-09-13 18:13:01 +00:00
committed by Dawn LUCI CQ
parent 5b3707a2d7
commit e53b6f9502
28 changed files with 272 additions and 50 deletions

View File

@@ -1,5 +1,6 @@
@compute
@workgroup_size(1)
fn main() {
var v = select(true & true, true, false);
let a = true;
var v = select(a & true, true, false);
}

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void main() {
bool v = (false ? true : (true & true));
bool v = (false ? true : true);
return;
}

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void main() {
bool v = (false ? true : (true & true));
bool v = (false ? true : true);
return;
}

View File

@@ -1,7 +1,7 @@
#version 310 es
void tint_symbol() {
bool v = (false ? true : bool(uint(true) & uint(true)));
bool v = (false ? true : true);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -2,7 +2,8 @@
using namespace metal;
kernel void tint_symbol() {
bool v = select(bool(true & true), true, false);
bool const a = true;
bool v = select(bool(a & true), true, false);
return;
}

View File

@@ -12,14 +12,14 @@
%void = OpTypeVoid
%1 = OpTypeFunction %void
%bool = OpTypeBool
%7 = OpConstantNull %bool
%true = OpConstantTrue %bool
%8 = OpConstantNull %bool
%_ptr_Function_bool = OpTypePointer Function %bool
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_bool Function %7
%v = OpVariable %_ptr_Function_bool Function %8
%9 = OpLogicalAnd %bool %true %true
%5 = OpSelect %bool %7 %true %9
OpStore %v %5
%7 = OpSelect %bool %8 %true %9
OpStore %v %7
OpReturn
OpFunctionEnd

View File

@@ -1,4 +1,5 @@
@compute @workgroup_size(1)
fn main() {
var v = select((true & true), true, false);
let a = true;
var v = select((a & true), true, false);
}

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const bool r = (true & false);
const bool r = false;
return;
}

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const bool r = (true & false);
const bool r = false;
return;
}

View File

@@ -1,7 +1,7 @@
#version 310 es
void f() {
bool r = bool(uint(true) & uint(false));
bool r = false;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const int r = (1 & 2);
const int r = 0;
return;
}

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const int r = (1 & 2);
const int r = 0;
return;
}

View File

@@ -1,7 +1,7 @@
#version 310 es
void f() {
int r = (1 & 2);
int r = 0;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const uint r = (1u & 2u);
const uint r = 0u;
return;
}

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const uint r = (1u & 2u);
const uint r = 0u;
return;
}

View File

@@ -1,7 +1,7 @@
#version 310 es
void f() {
uint r = (1u & 2u);
uint r = 0u;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const int r = (1 | 2);
const int r = 3;
return;
}

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const int r = (1 | 2);
const int r = 3;
return;
}

View File

@@ -1,7 +1,7 @@
#version 310 es
void f() {
int r = (1 | 2);
int r = 3;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const uint r = (1u | 2u);
const uint r = 3u;
return;
}

View File

@@ -1,5 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const uint r = (1u | 2u);
const uint r = 3u;
return;
}

View File

@@ -1,7 +1,7 @@
#version 310 es
void f() {
uint r = (1u | 2u);
uint r = 3u;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;