mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
* fix(asm): consider asm blocks as volatile When asm blocks are not marked as volatile, they may be (wrongly) discarded by LLVM optimization passes. * fix(asm): mark syscall as clobbering return register The `syscall` instruction returns the system call result in the `rax` register. * feat(asm): add push instructions. * feat(asm): add pop instructions
20 lines
433 B
Plaintext
20 lines
433 B
Plaintext
// #target: macos-x64
|
|
module testing;
|
|
|
|
fn void start() @export("_start") @naked @nostrip {
|
|
asm {
|
|
movq $rax, 0x3c;
|
|
movq $rdi, 42;
|
|
syscall;
|
|
}
|
|
}
|
|
|
|
/* #expect: testing.ll
|
|
|
|
define void @_start() #0 {
|
|
entry:
|
|
call void asm sideeffect alignstack "movq $$60, %rax\0Amovq $$42, %rdi\0Asyscall \0A", "~{cc},~{rax},~{rcx},~{r8},~{r11},~{flags},~{dirflag},~{fspr}"()
|
|
ret void
|
|
}
|
|
|