mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
29 lines
557 B
Plaintext
29 lines
557 B
Plaintext
// #target: macos-x64
|
|
module test;
|
|
import std;
|
|
fn void main()
|
|
{
|
|
char[8] foo = {255, 0, 0, 0, 0, 0, 0, 0};
|
|
io::printn(to_ulong(&foo));
|
|
}
|
|
|
|
fn ulong to_ulong(char[8]* buf) @naked @noinline
|
|
{
|
|
asm
|
|
{
|
|
movq $rax, [buf];
|
|
ret;
|
|
}
|
|
unreachable();
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
define i64 @test.to_ulong(ptr %0) #1 {
|
|
entry:
|
|
call void asm sideeffect alignstack "movq ($0), %rax\0Aret \0A", "r,~{rax},~{flags},~{dirflag},~{fspr}"(ptr %0)
|
|
unreachable
|
|
}
|
|
|
|
attributes #1 = { naked noinline nounwind uwtable "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
|