tint: Implement const eval of binary multiply

Bug: tint:1581
Change-Id: I70ff40ed4d8faf0a665824fef936ffbafb3f0948
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99362
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Antonio Maiorano
2022-09-01 14:57:39 +00:00
committed by Dawn LUCI CQ
parent ae6f76fe3a
commit c20c5dfb4a
35 changed files with 1243 additions and 482 deletions

View File

@@ -1,5 +1,5 @@
float main() {
return (((2.0f * 3.0f) - 4.0f) / 5.0f);
return (2.0f / 5.0f);
}
[numthreads(2, 1, 1)]

View File

@@ -1,5 +1,5 @@
float main() {
return (((2.0f * 3.0f) - 4.0f) / 5.0f);
return (2.0f / 5.0f);
}
[numthreads(2, 1, 1)]

View File

@@ -2,7 +2,7 @@
using namespace metal;
float tint_symbol() {
return (((2.0f * 3.0f) - 4.0f) / 5.0f);
return (2.0f / 5.0f);
}
kernel void ep() {

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -12,19 +12,15 @@
%float = OpTypeFloat 32
%1 = OpTypeFunction %float
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%void = OpTypeVoid
%12 = OpTypeFunction %void
%8 = OpTypeFunction %void
%main = OpFunction %float None %1
%4 = OpLabel
%7 = OpFMul %float %float_2 %float_3
%9 = OpFSub %float %7 %float_4
%11 = OpFDiv %float %9 %float_5
OpReturnValue %11
%7 = OpFDiv %float %float_2 %float_5
OpReturnValue %7
OpFunctionEnd
%ep = OpFunction %void None %12
%15 = OpLabel
%ep = OpFunction %void None %8
%11 = OpLabel
OpReturn
OpFunctionEnd