Answer the question
In order to leave comments, you need to log in
GCC generates bad code?
Keys:
-m64 -ffreestanding -nostdlib -mcmodel=large -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -pedantic
inline thread_t* schedule(thread_t* current, tss_t* tss) {
tss->rsp[0] = sizeof(x86_64_state_t)+(uint64_t)current;
return current;
}
0000000000000000 <schedule>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 48 89 7d f8 mov %rdi,-0x8(%rbp)
8: 48 89 75 f0 mov %rsi,-0x10(%rbp)
c: 48 8b 45 f8 mov -0x8(%rbp),%rax
10: 48 8d 90 b0 01 00 00 lea 0x1b0(%rax),%rdx
17: 48 8b 45 f0 mov -0x10(%rbp),%rax
1b: 48 89 50 04 mov %rdx,0x4(%rax)
1f: 48 8b 45 f8 mov -0x8(%rbp),%rax
23: 5d pop %rbp
24: c3 retq
Answer the question
In order to leave comments, you need to log in
Check out:
gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
In general, the documentation of GCC itself is a much more reliable source of information than unnamed uncles who "usually recommend" something there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question