mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
34 lines
698 B
Plaintext
34 lines
698 B
Plaintext
// #target: macos-x64
|
|
|
|
fn bool f0_0(void* a0) @private { return (bool)a0; }
|
|
|
|
fn int f0() { return (int)f0_0((void*)0x2); }
|
|
|
|
alias Test = fn void();
|
|
|
|
fn bool f1() { Test x @noinit; return (bool)(x = (Test)0); }
|
|
|
|
/* #expect: bool_conversions.ll
|
|
|
|
define internal zeroext i8 @bool_conversions.f0_0(ptr %0) #0 {
|
|
entry:
|
|
%i2b = icmp ne ptr %0, null
|
|
%1 = zext i1 %i2b to i8
|
|
ret i8 %1
|
|
}
|
|
|
|
define i32 @bool_conversions.f0() #0 {
|
|
entry:
|
|
%0 = call i8 @bool_conversions.f0_0(ptr inttoptr (i64 2 to ptr))
|
|
%1 = trunc i8 %0 to i1
|
|
%zext = zext i1 %1 to i32
|
|
ret i32 %zext
|
|
}
|
|
|
|
define zeroext i8 @bool_conversions.f1() #0 {
|
|
entry:
|
|
%x = alloca ptr, align 8
|
|
store ptr null, ptr %x, align 8
|
|
ret i8 0
|
|
}
|