Files
c3c/test/test_suite/cast/cast_ptr_vec_to_bool.c3t
2025-01-05 15:45:39 +01:00

26 lines
596 B
Plaintext

// #target: macos-x64
module test;
fn void main()
{
int xd;
void*[<2>] x = { &xd, null };
bool[<2>] y = (bool[<2>])x;
}
/* #expect: test.ll
entry:
%xd = alloca i32, align 4
%x = alloca <2 x ptr>, align 16
%y = alloca <2 x i8>, align 2
store i32 0, ptr %xd, align 4
%0 = insertelement <2 x ptr> undef, ptr %xd, i64 0
%1 = insertelement <2 x ptr> %0, ptr null, i64 1
store <2 x ptr> %1, ptr %x, align 16
%2 = load <2 x ptr>, ptr %x, align 16
%i2b = icmp ne <2 x ptr> %2, zeroinitializer
%3 = sext <2 x i1> %i2b to <2 x i8>
store <2 x i8> %3, ptr %y, align 2
ret void
}