mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
27 lines
563 B
Plaintext
27 lines
563 B
Plaintext
// #target: macos-x64
|
|
module abc;
|
|
alias UInt8 = char;
|
|
fn void main()
|
|
{
|
|
UInt8 x = 17;
|
|
UInt8 y = 5;
|
|
UInt8 z = (x >> y) & 0x1;
|
|
}
|
|
/* #expect: abc.ll
|
|
|
|
entry:
|
|
%x = alloca i8, align 1
|
|
%y = alloca i8, align 1
|
|
%z = alloca i8, align 1
|
|
store i8 17, ptr %x, align 1
|
|
store i8 5, ptr %y, align 1
|
|
%0 = load i8, ptr %x, align 1
|
|
%zext = zext i8 %0 to i32
|
|
%1 = load i8, ptr %y, align 1
|
|
%zext1 = zext i8 %1 to i32
|
|
%lshr = lshr i32 %zext, %zext1
|
|
%2 = freeze i32 %lshr
|
|
%and = and i32 %2, 1
|
|
%trunc = trunc i32 %and to i8
|
|
store i8 %trunc, ptr %z, align 1
|