-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
arch-x86_6464-bit x8664-bit x86backend-self-hostedenhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.optimization
Milestone
Description
zig version: 0.14.0-dev.2916+d916954be
export fn f(a: usize) usize {
return a + 1;
}zig build-obj -fno-llvm -fno-lld test.zig -OReleaseFast
Observed machine code:
0000000000000000 <f>:
0: 55 push rbp
1: 48 89 e5 mov rbp,rsp
4: 48 83 ec 08 sub rsp,0x8
8: 48 89 3c 24 mov QWORD PTR [rsp],rdi
c: 48 83 c7 01 add rdi,0x1
10: 48 89 f8 mov rax,rdi
13: 48 89 ec mov rsp,rbp
16: 5d pop rbp
17: c3 ret
Expected machine code, something more like this:
f:
lea rax, [rdi + 1]
ret
Metadata
Metadata
Assignees
Labels
arch-x86_6464-bit x8664-bit x86backend-self-hostedenhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.optimization