// #target: macos-x64 module testing; import std::io; struct Foo { bitstruct : ushort { short expand : 0..7; } void* widget; } struct Foo2 { bitstruct : char[2] { short expand : 0..7; } void* widget; } struct Foo3 { bitstruct : char[2] { bool a : 0; short expand : 1..7; bool b : 8; } void* widget; } struct Foo4 { bitstruct : short { bool a : 0; short expand : 1..7; bool b : 8; } void* widget; } fn void main() { void* foo; Foo *f = &&(Foo) { .expand = 2, .widget = &f }; Foo2 *f2 = &&(Foo2) { .expand = 2, .widget = &f }; Foo3 *f3 = &&(Foo3) { .expand = 2, .a = true, .b = true, .widget = &f }; Foo4 *f4 = &&(Foo4) { .expand = 2, .a = true, .b = true, .widget = &f }; } /* #expect: testing.ll define void @testing.main() #0 { entry: %foo = alloca ptr, align 8 %f = alloca ptr, align 8 %literal = alloca %Foo, align 8 %f2 = alloca ptr, align 8 %literal2 = alloca %Foo2, align 8 %f3 = alloca ptr, align 8 %literal6 = alloca %Foo3, align 8 %f4 = alloca ptr, align 8 %literal11 = alloca %Foo4, align 8 store ptr null, ptr %foo, align 8 store i16 0, ptr %literal, align 8 %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 store ptr null, ptr %ptradd, align 8 %0 = load i16, ptr %literal, align 8 %1 = and i16 %0, -256 %2 = or i16 %1, 2 store i16 %2, ptr %literal, align 8 %ptradd1 = getelementptr inbounds i8, ptr %literal, i64 8 store ptr %f, ptr %ptradd1, align 8 store ptr %literal, ptr %f, align 8 store i8 0, ptr %literal2, align 1 %ptradd3 = getelementptr inbounds i8, ptr %literal2, i64 1 store i8 0, ptr %ptradd3, align 1 %ptradd4 = getelementptr inbounds i8, ptr %literal2, i64 8 store ptr null, ptr %ptradd4, align 8 store i8 2, ptr %literal2, align 1 %ptradd5 = getelementptr inbounds i8, ptr %literal2, i64 8 store ptr %f, ptr %ptradd5, align 8 store ptr %literal2, ptr %f2, align 8 store i8 0, ptr %literal6, align 1 %ptradd7 = getelementptr inbounds i8, ptr %literal6, i64 1 store i8 0, ptr %ptradd7, align 1 %ptradd8 = getelementptr inbounds i8, ptr %literal6, i64 8 store ptr null, ptr %ptradd8, align 8 %3 = load i8, ptr %literal6, align 1 %4 = and i8 %3, 1 %5 = or i8 %4, 4 store i8 %5, ptr %literal6, align 1 %6 = load i8, ptr %literal6, align 1 %7 = and i8 %6, -2 %8 = or i8 %7, 1 store i8 %8, ptr %literal6, align 1 %ptradd9 = getelementptr inbounds i8, ptr %literal6, i64 1 %9 = load i8, ptr %ptradd9, align 1 %10 = and i8 %9, -2 %11 = or i8 %10, 1 store i8 %11, ptr %ptradd9, align 1 %ptradd10 = getelementptr inbounds i8, ptr %literal6, i64 8 store ptr %f, ptr %ptradd10, align 8 store ptr %literal6, ptr %f3, align 8 store i16 0, ptr %literal11, align 8 %ptradd12 = getelementptr inbounds i8, ptr %literal11, i64 8 store ptr null, ptr %ptradd12, align 8 %12 = load i16, ptr %literal11, align 8 %13 = and i16 %12, -255 %14 = or i16 %13, 4 store i16 %14, ptr %literal11, align 8 %15 = load i16, ptr %literal11, align 8 %16 = and i16 %15, -2 %17 = or i16 %16, 1 store i16 %17, ptr %literal11, align 8 %18 = load i16, ptr %literal11, align 8 %19 = and i16 %18, -257 %20 = or i16 %19, 256 store i16 %20, ptr %literal11, align 8 %ptradd13 = getelementptr inbounds i8, ptr %literal11, i64 8 store ptr %f, ptr %ptradd13, align 8 store ptr %literal11, ptr %f4, align 8 ret void }