Files
c3c/test/test_suite/asm/naked_call_with_instructions.c3t

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" }