src/codegen/spirv/Assembler.zig: fix OpConstant /w floats
apologies if this wasn't an oversight and if there was some reason behind the lack of a return but i couldn't find any indications towards that
previously, the following code would fail to compile:
export fn main() callconv(.spirv_kernel) void {
asm volatile (
\\ %f32 = OpTypeFloat 32
\\ %foo = OpConstant %f32 0
);
}
with the following output:
test2.zig:1:8: error: failed to assemble SPIR-V inline assembly
export fn main() callconv(.spirv_kernel) void {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test2.zig:1:8: note: cannot parse literal constant
cc @alichraghi
Does this even compile? You are returning a return statement when it reaches the else branch.
And from a quick glance parseContextDependentFloat does not even return a value. Since it appends the operand inside of the function.
it does compile, noreturn (the type of a return statement) can be coerced into any type afaik.
the issue with the function is not that it doesn't return some value, it's the fact that it falls down to ass.fail
I see, my bad then.
oops, i didn't think new commits would get reflected here
sorry about that..