tint: make const eval of binary ops on concrete values fail on NaN/Inf

With this CL, binary ops add, subtract, multiply, and divide of concrete
values will now produce an error if the result is inf/NaN, as it was
doing with abstract values. This also affects the cross builtin, which
is written in terms of subtract and multiply.

Bug: tint:1581
Bug: tint:1747
Change-Id: Ib1d0d8deddc82c67ab53729a6011937636fcc1a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110163
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Antonio Maiorano
2022-11-18 05:45:17 +00:00
parent e956a04daf
commit 0da91e06c5
13 changed files with 145 additions and 165 deletions

View File

@@ -146,7 +146,7 @@ OpDecorate %20 Binding 1
%128 = OpLoad %50 %10
%129 = OpLoad %52 %20
%130 = OpSampledImage %124 %129 %128
%131 = OpImageSampleProjImplicitLod %v4float %130 %126
%131 = OpImageSampleProjImplicitLod %v4float %130 %47
OpReturn
OpFunctionEnd

View File

@@ -146,7 +146,7 @@ OpDecorate %20 Binding 1
%128 = OpLoad %50 %10
%129 = OpLoad %52 %20
%130 = OpSampledImage %124 %129 %128
%131 = OpImageSampleProjExplicitLod %v4float %130 %126 Lod %29
%131 = OpImageSampleProjExplicitLod %v4float %130 %47 Lod %29
OpReturn
OpFunctionEnd

View File

@@ -146,7 +146,7 @@ OpDecorate %20 Binding 1
%128 = OpLoad %50 %10
%129 = OpLoad %52 %20
%130 = OpSampledImage %124 %129 %128
%131 = OpImageSampleProjDrefImplicitLod %float %130 %126 %float_0_200000003
%131 = OpImageSampleProjDrefImplicitLod %float %130 %47 %float_0_200000003
OpReturn
OpFunctionEnd

View File

@@ -146,7 +146,7 @@ OpDecorate %20 Binding 1
%128 = OpLoad %50 %10
%129 = OpLoad %52 %20
%130 = OpSampledImage %124 %129 %128
%131 = OpImageSampleProjDrefExplicitLod %float %130 %126 %float_0_200000003 Lod %29
%131 = OpImageSampleProjDrefExplicitLod %float %130 %47 %float_0_200000003 Lod %29
OpReturn
OpFunctionEnd

View File

@@ -63,7 +63,7 @@
%main = OpFunction %void None %21
%39 = OpLabel
%undefined = OpVariable %_ptr_Function_float Function
%40 = OpFMod %float %float_5 %float_0
%40 = OpFMod %float %float_5 %float_5
OpStore %undefined %40
%41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
%10 = OpLoad %int %41

View File

@@ -30,7 +30,7 @@ fn main_1() {
var undefined : f32;
var x_51 : bool;
var x_52_phi : bool;
undefined = (5.0 - (0.0 * floor((5.0 / 0.0f))));
undefined = (5.0 - (0.0 * floor((5.0 / 5.0f))));
let x_10 : i32 = x_6.x_GLF_uniform_int_values[0].el;
let x_11 : i32 = x_6.x_GLF_uniform_int_values[0].el;
let x_12 : i32 = x_6.x_GLF_uniform_int_values[1].el;