[Bug rtl-optimization/66152] suboptimal load bytes to stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66152 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek --- That changed with r263511, which now treats the {0,1,2,3,4,5,6,7} initializer like "\0\1\2\3\4\5\6\7", so that means even GCC 8 expanded the latter this way.
[Bug rtl-optimization/66152] suboptimal load bytes to stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66152 --- Comment #4 from SztfG at yandex dot ru --- GCC from trunk doing this: .Ltext0: .LC0: .string "" .ascii "\001\002\003\004\005\006\007" bar: .LFB0: sub rsp, 24 mov rax, QWORD PTR .LC0[rip] lea rdi, [rsp+8] mov QWORD PTR [rsp+8], rax call foo .LVL0: add rsp, 24 ret .LFE0: instead movabsq $506097522914230528, %rax
[Bug rtl-optimization/66152] suboptimal load bytes to stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66152 Tomasz Konojacki changed: What|Removed |Added CC||me at xenu dot pl --- Comment #3 from Tomasz Konojacki --- gcc 8.1 generates the following code: bar(): movabsq $506097522914230528, %rax subq$24, %rsp leaq8(%rsp), %rdi movq%rax, 8(%rsp) callfoo(char*) addq$24, %rsp ret I believe this ticket should be closed.
[Bug rtl-optimization/66152] suboptimal load bytes to stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66152 --- Comment #2 from Andrew Pinski --- I think there might be already another bug about this same exact thing but I can't seem to find it right now.
[Bug rtl-optimization/66152] suboptimal load bytes to stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66152 --- Comment #1 from SztfG at yandex dot ru --- If array of char is initialized using string, gcc can use larger mov instruction, like movabsq, movq, movl etc. but not movdqa, movaps or other xmm But if zero byte appears in string, compiler always create a separate array and copy it to stack, using various mov instruction, except xmm-based void bar(void) { char a[4] = "\x00\x02\x03\x04"; foo(a); } produces .LC0: .string "" .string "\002\003\004" bar: subq$24, %rsp movl.LC0(%rip), %eax movq%rsp, %rdi movl%eax, (%rsp) callfoo addq$24, %rsp ret