Files
c3c/test/test_suite/expressions/bool_conversions.c3t
Christoffer Lerno 8b49e6c14d Rename def to alias.
2025-03-13 11:22:27 +01:00

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
}