Files
c3c/test/test_suite/compile_time_introspection/defined_2.c3t
Christoffer Lerno fad0adfcd0 Fix testcase.
2023-07-25 11:25:20 +02:00

43 lines
798 B
C

// #target: macos-x64
module testing;
import std::io;
fn void! main()
{
Bits b1;
Bits b2;
bool x = equals(b1, b2);
}
bitstruct Bits : char
{
bool flag;
}
fn bool Bits.equals(a, Bits b)
{
return a.flag == b.flag;
}
/* #expect: testing.ll
define i64 @testing.main() #0 {
entry:
%b1 = alloca i8, align 1
%b2 = alloca i8, align 1
%x = alloca i8, align 1
%a = alloca i8, align 1
%b = alloca i8, align 1
store i8 0, ptr %b1, align 1
store i8 0, ptr %b2, align 1
%0 = load i8, ptr %b1, align 1
store i8 %0, ptr %a, align 1
%1 = load i8, ptr %b2, align 1
store i8 %1, ptr %b, align 1
%2 = load i8, ptr %a, align 1
%3 = load i8, ptr %b, align 1
%4 = call i8 @testing.Bits.equals(i8 zeroext %2, i8 zeroext %3)
store i8 %4, ptr %x, align 1
ret i64 0
}