[const-eval] fix evaluation of bool constuctors

This commit is contained in:
teoxoy
2024-02-13 14:51:03 +01:00
committed by Teodor Tanasoaia
parent a946a6f0ad
commit ff332afdef
6 changed files with 13 additions and 16 deletions

View File

@@ -216,8 +216,8 @@ impl crate::Literal {
(value, crate::ScalarKind::Sint, 4) => Some(Self::I32(value as _)),
(value, crate::ScalarKind::Uint, 8) => Some(Self::U64(value as _)),
(value, crate::ScalarKind::Sint, 8) => Some(Self::I64(value as _)),
(1, crate::ScalarKind::Bool, 4) => Some(Self::Bool(true)),
(0, crate::ScalarKind::Bool, 4) => Some(Self::Bool(false)),
(1, crate::ScalarKind::Bool, crate::BOOL_WIDTH) => Some(Self::Bool(true)),
(0, crate::ScalarKind::Bool, crate::BOOL_WIDTH) => Some(Self::Bool(false)),
_ => None,
}
}

View File

@@ -31,7 +31,6 @@ void main() {
uvec2 cit0_ = uvec2(0u);
mat2x2 cit1_ = mat2x2(vec2(0.0), vec2(0.0));
int cit2_[4] = int[4](0, 1, 2, 3);
bool ic0_ = bool(false);
uvec2 ic4_ = uvec2(0u, 0u);
mat2x3 ic5_ = mat2x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0));
}

View File

@@ -49,7 +49,6 @@ void main()
uint2 cit0_ = (0u).xx;
float2x2 cit1_ = float2x2((0.0).xx, (0.0).xx);
int cit2_[4] = Constructarray4_int_(0, 1, 2, 3);
bool ic0_ = bool((bool)0);
uint2 ic4_ = uint2(0u, 0u);
float2x3 ic5_ = float2x3(float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0));
}

View File

@@ -39,7 +39,6 @@ kernel void main_(
metal::uint2 cit0_ = metal::uint2(0u);
metal::float2x2 cit1_ = metal::float2x2(metal::float2(0.0), metal::float2(0.0));
type_11 cit2_ = type_11 {0, 1, 2, 3};
bool ic0_ = static_cast<bool>(bool {});
metal::uint2 ic4_ = metal::uint2(0u, 0u);
metal::float2x3 ic5_ = metal::float2x3(metal::float3(0.0, 0.0, 0.0), metal::float3(0.0, 0.0, 0.0));
}

View File

@@ -67,17 +67,18 @@ OpDecorate %17 ArrayStride 4
%56 = OpConstantComposite %14 %55 %55
%57 = OpConstantComposite %9 %21 %21
%58 = OpConstantComposite %8 %57 %57
%59 = OpConstantComposite %14 %55 %55
%60 = OpConstantComposite %7 %21 %21 %21
%61 = OpConstantComposite %20 %60 %60
%62 = OpConstantNull %20
%64 = OpTypePointer Function %6
%65 = OpConstantNull %6
%59 = OpConstantFalse %13
%60 = OpConstantComposite %14 %55 %55
%61 = OpConstantComposite %7 %21 %21 %21
%62 = OpConstantComposite %20 %61 %61
%63 = OpConstantNull %20
%65 = OpTypePointer Function %6
%66 = OpConstantNull %6
%44 = OpFunction %2 None %45
%43 = OpLabel
%63 = OpVariable %64 Function %65
OpBranch %66
%66 = OpLabel
OpStore %63 %47
%64 = OpVariable %65 Function %66
OpBranch %67
%67 = OpLabel
OpStore %64 %47
OpReturn
OpFunctionEnd

View File

@@ -26,7 +26,6 @@ fn main() {
let cit0_ = vec2(0u);
let cit1_ = mat2x2<f32>(vec2(0f), vec2(0f));
let cit2_ = array<i32, 4>(0i, 1i, 2i, 3i);
let ic0_ = bool(bool());
let ic4_ = vec2<u32>(0u, 0u);
let ic5_ = mat2x3<f32>(vec3<f32>(0f, 0f, 0f), vec3<f32>(0f, 0f, 0f));
}