mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Refactor casts, removing SLBOOL and PTRBOOL.
This commit is contained in:
25
test/test_suite/cast/cast_ptr_vec_to_bool.c3t
Normal file
25
test/test_suite/cast/cast_ptr_vec_to_bool.c3t
Normal file
@@ -0,0 +1,25 @@
|
||||
// #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
|
||||
}
|
||||
Reference in New Issue
Block a user